Add required support for GameLift TLS certificate (#7564)
* Add required support for GameLift TLS certificate * Update based on feedback
This commit is contained in:
+13
-4
@@ -44,14 +44,23 @@ namespace AWSGameLift
|
||||
{
|
||||
Multiplayer::SessionConnectionConfig sessionConnectionConfig;
|
||||
auto createPlayerSessionResult = createPlayerSessionOutcome.GetResult();
|
||||
// TODO: AWSNativeSDK needs to be updated to support this attribute, and it is a must have for TLS certificate enabled fleet
|
||||
//sessionConnectionConfig.m_dnsName = createPlayerSessionResult.GetPlayerSession().GetDnsName().c_str();
|
||||
sessionConnectionConfig.m_ipAddress = createPlayerSessionResult.GetPlayerSession().GetIpAddress().c_str();
|
||||
AZStd::string_view dnsName = createPlayerSessionResult.GetPlayerSession().GetDnsName().c_str();
|
||||
AZStd::string_view ipAddress = createPlayerSessionResult.GetPlayerSession().GetIpAddress().c_str();
|
||||
// When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not the IP address.
|
||||
if (dnsName.ends_with(AWSGameLiftTLSEnabledDNSSuffix))
|
||||
{
|
||||
sessionConnectionConfig.m_dnsName = dnsName;
|
||||
}
|
||||
else
|
||||
{
|
||||
sessionConnectionConfig.m_ipAddress = ipAddress;
|
||||
}
|
||||
sessionConnectionConfig.m_playerSessionId = createPlayerSessionResult.GetPlayerSession().GetPlayerSessionId().c_str();
|
||||
sessionConnectionConfig.m_port = static_cast<uint16_t>(createPlayerSessionResult.GetPlayerSession().GetPort());
|
||||
|
||||
AZ_TracePrintf(AWSGameLiftJoinSessionActivityName,
|
||||
"Built SessionConnectionConfig with IpAddress=%s, PlayerSessionId=%s and Port=%d",
|
||||
"Built SessionConnectionConfig with DnsName=%s, IpAddress=%s, PlayerSessionId=%s and Port=%d",
|
||||
sessionConnectionConfig.m_dnsName.c_str(),
|
||||
sessionConnectionConfig.m_ipAddress.c_str(),
|
||||
sessionConnectionConfig.m_playerSessionId.c_str(),
|
||||
sessionConnectionConfig.m_port);
|
||||
|
||||
+20
-1
@@ -28,7 +28,7 @@ TEST_F(AWSGameLiftJoinSessionActivityTest, BuildAWSGameLiftCreatePlayerSessionRe
|
||||
EXPECT_TRUE(strcmp(awsRequest.GetGameSessionId().c_str(), request.m_sessionId.c_str()) == 0);
|
||||
}
|
||||
|
||||
TEST_F(AWSGameLiftJoinSessionActivityTest, BuildSessionConnectionConfig_Call_GetExpectedResult)
|
||||
TEST_F(AWSGameLiftJoinSessionActivityTest, BuildSessionConnectionConfig_Call_GetIpAddressAsDestinationResult)
|
||||
{
|
||||
Aws::GameLift::Model::PlayerSession playerSession;
|
||||
playerSession.SetIpAddress("dummyIpAddress");
|
||||
@@ -39,11 +39,30 @@ TEST_F(AWSGameLiftJoinSessionActivityTest, BuildSessionConnectionConfig_Call_Get
|
||||
Aws::GameLift::Model::CreatePlayerSessionOutcome createPlayerSessionOutcome(createPlayerSessionResult);
|
||||
auto connectionConfig = JoinSessionActivity::BuildSessionConnectionConfig(createPlayerSessionOutcome);
|
||||
|
||||
EXPECT_TRUE(strcmp(connectionConfig.m_dnsName.c_str(), "") == 0);
|
||||
EXPECT_TRUE(strcmp(connectionConfig.m_ipAddress.c_str(), playerSession.GetIpAddress().c_str()) == 0);
|
||||
EXPECT_TRUE(strcmp(connectionConfig.m_playerSessionId.c_str(), playerSession.GetPlayerSessionId().c_str()) == 0);
|
||||
EXPECT_TRUE(connectionConfig.m_port == playerSession.GetPort());
|
||||
}
|
||||
|
||||
TEST_F(AWSGameLiftJoinSessionActivityTest, BuildSessionConnectionConfig_Call_GetDNSAsDestinationResult)
|
||||
{
|
||||
Aws::GameLift::Model::PlayerSession playerSession;
|
||||
playerSession.SetDnsName("gameliftunittest.amazongamelift.com");
|
||||
playerSession.SetIpAddress("dummyIpAddress");
|
||||
playerSession.SetPlayerSessionId("dummyPlayerSessionId");
|
||||
playerSession.SetPort(123);
|
||||
Aws::GameLift::Model::CreatePlayerSessionResult createPlayerSessionResult;
|
||||
createPlayerSessionResult.SetPlayerSession(playerSession);
|
||||
Aws::GameLift::Model::CreatePlayerSessionOutcome createPlayerSessionOutcome(createPlayerSessionResult);
|
||||
auto connectionConfig = JoinSessionActivity::BuildSessionConnectionConfig(createPlayerSessionOutcome);
|
||||
|
||||
EXPECT_TRUE(strcmp(connectionConfig.m_dnsName.c_str(), playerSession.GetDnsName().c_str()) == 0);
|
||||
EXPECT_TRUE(strcmp(connectionConfig.m_ipAddress.c_str(), "") == 0);
|
||||
EXPECT_TRUE(strcmp(connectionConfig.m_playerSessionId.c_str(), playerSession.GetPlayerSessionId().c_str()) == 0);
|
||||
EXPECT_TRUE(connectionConfig.m_port == playerSession.GetPort());
|
||||
}
|
||||
|
||||
TEST_F(AWSGameLiftJoinSessionActivityTest, ValidateJoinSessionRequest_CallWithBaseType_GetFalseResult)
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
|
||||
Reference in New Issue
Block a user