Beispiel #1
0
 public override string ToString()
 {
     return(MsalCacheCommon.GetCredentialKey(
                _homeAccountId,
                _environment,
                MsalCacheCommon.AccessToken,
                _clientId,
                _tenantId,
                _normalizedScopes));
 }
 public override string ToString()
 {
     return(MsalCacheCommon.GetCredentialKey(
                _homeAccountId,
                _environment,
                MsalCacheCommon.RefreshToken,
                _clientId,
                tenantId: null,
                scopes: null));
 }
Beispiel #3
0
        /// <summary>
        /// Gets a key that is smaller than 255 characters, which is a limitation for
        /// UWP storage. This is done by hashing the scopes and env.
        /// </summary>
        /// <remarks>
        /// accountId - two guids plus separator - 73 chars
        /// "accesstoken" string - 11 chars
        /// env - ussually loging.microsoft.net - 20 chars
        /// clientid - a guid - 36 chars
        /// tenantid - a guid - 36 chars
        /// scopes - a sha256 string - 44 chars
        /// delimiters - 4 chars
        /// total: 224 chars
        /// </remarks>
        public string GetUWPFixedSizeKey()
        {
            var crypto = PlatformProxyFactory.GetPlatformProxy().CryptographyManager;

            return(MsalCacheCommon.GetCredentialKey(
                       _homeAccountId,
                       _environment,
                       MsalCacheCommon.AccessToken,
                       _clientId,
                       _tenantId,
                       crypto.CreateSha256Hash(_normalizedScopes))); // can't use scopes and env because they are of variable length
        }