namespace PlayFab { public sealed class PlayFabAuthenticationContext { public PlayFabAuthenticationContext() { } public PlayFabAuthenticationContext(string clientSessionTicket, string entityToken, string playFabId, string entityId, string entityType, string telemetryKey = null) : this() { #if !DISABLE_PLAYFABCLIENT_API ClientSessionTicket = clientSessionTicket; PlayFabId = playFabId; #endif #if !DISABLE_PLAYFABENTITY_API EntityToken = entityToken; EntityId = entityId; EntityType = entityType; #endif TelemetryKey = telemetryKey; } public void CopyFrom(PlayFabAuthenticationContext other) { #if !DISABLE_PLAYFABCLIENT_API ClientSessionTicket = other.ClientSessionTicket; PlayFabId = other.PlayFabId; #endif #if !DISABLE_PLAYFABENTITY_API EntityToken = other.EntityToken; EntityId = other.EntityId; EntityType = other.EntityType; #endif TelemetryKey = other.TelemetryKey; } #if !DISABLE_PLAYFABCLIENT_API /// Allows access to the ClientAPI public string ClientSessionTicket; /// The master player entity Id public string PlayFabId; public bool IsClientLoggedIn() { return !string.IsNullOrEmpty(ClientSessionTicket); } #endif #if !DISABLE_PLAYFABENTITY_API /// Allows access to most Entity APIs public string EntityToken; /// /// Clients: The title player entity Id (unless replaced with a related entity) /// Servers: The title id (unless replaced with a related entity) /// public string EntityId; /// /// Describes the type of entity identified by EntityId /// public string EntityType; public bool IsEntityLoggedIn() { return !string.IsNullOrEmpty(EntityToken); } #endif public string TelemetryKey; public bool IsTelemetryKeyProvided() { return !string.IsNullOrEmpty(TelemetryKey); } public void ForgetAllCredentials() { #if !DISABLE_PLAYFABCLIENT_API PlayFabId = null; ClientSessionTicket = null; #endif #if !DISABLE_PLAYFABENTITY_API EntityToken = null; EntityId = null; EntityType = null; #endif TelemetryKey = null; } } }