예제 #1
0
 public MsalIdTokenCacheItem GetIdToken(MsalIdTokenCacheKey idTokenKey)
 {
     if (_idTokenCacheDictionary.TryGetValue(idTokenKey.ToString(), out var cacheItem))
     {
         return(cacheItem);
     }
     return(null);
 }
 public void DeleteIdToken(MsalIdTokenCacheKey cacheKey)
 {
     if (!_idTokenCacheDictionary.TryRemove(cacheKey.ToString(), out _))
     {
         _logger.InfoPii(
             $"Cannot delete an id token because it was already deleted. Key {cacheKey}",
             "Cannot delete an id token because it was already deleted");
     }
 }
        public string GetIdToken(MsalIdTokenCacheKey idTokenKey)
        {
            var strKey = idTokenKey.ToString();

            if (!IdTokenCacheDictionary.ContainsKey(strKey))
            {
                return(null);
            }

            return(IdTokenCacheDictionary[strKey]);
        }
예제 #4
0
        public string GetIdToken(MsalIdTokenCacheKey idTokenKey)
        {
            var keyStr = idTokenKey.ToString();

            if (!_idTokenContainer.Values.ContainsKey(/*encodedKey*/ keyStr))
            {
                return(null);
            }
            return(CoreHelpers.ByteArrayToString(
                       GetCacheValue((ApplicationDataCompositeValue)_idTokenContainer.Values[
                                         /*CoreCryptographyHelpers.CreateBase64UrlEncodedSha256Hash(idTokenKey)*/ keyStr])));
        }
예제 #5
0
 public void DeleteIdToken(MsalIdTokenCacheKey cacheKey)
 {
     Delete(cacheKey.ToString(), _idTokenSharedPreference.Edit());
 }
예제 #6
0
 public MsalIdTokenCacheItem GetIdToken(MsalIdTokenCacheKey idTokenKey)
 {
     return(MsalIdTokenCacheItem.FromJsonString(_idTokenSharedPreference.GetString(idTokenKey.ToString(), null)));
 }
        public void MsalIdTokenCacheKey()
        {
            var key = new MsalIdTokenCacheKey("login.microsoftonline.com", "contoso.com", "uid.utid", "clientid");

            Assert.AreEqual("uid.utid-login.microsoftonline.com-idtoken-clientid-contoso.com-", key.ToString());

            Assert.AreEqual("uid.utid-login.microsoftonline.com", key.iOSAccount);
            Assert.AreEqual("idtoken-clientid-contoso.com-", key.iOSService);
            Assert.AreEqual("idtoken-clientid-contoso.com", key.iOSGeneric);
            Assert.AreEqual((int)MsalCacheKeys.iOSCredentialAttrType.IdToken, key.iOSType);
        }
        public void MsalIdTokenCacheKey()
        {
            MsalIdTokenCacheKey key = new MsalIdTokenCacheKey("login.microsoftonline.com", "contoso.com", "uid.utid", "clientid");

            Assert.AreEqual("uid.utid-login.microsoftonline.com-idtoken-clientid-contoso.com-", key.ToString());

            Assert.AreEqual("uid.utid-login.microsoftonline.com", key.GetiOSAccountKey());
            Assert.AreEqual("idtoken-clientid-contoso.com-", key.GetiOSServiceKey());
            Assert.AreEqual("idtoken-clientid-contoso.com", key.GetiOSGenericKey());
        }
예제 #9
0
 public string GetIdToken(MsalIdTokenCacheKey idTokenKey)
 {
     return(_idTokenSharedPreference.GetString(idTokenKey.ToString(), null));
 }
예제 #10
0
 public void DeleteIdToken(MsalIdTokenCacheKey cacheKey)
 {
     _idTokenCacheDictionary.Remove(cacheKey.ToString());
 }
예제 #11
0
 public void DeleteIdToken(MsalIdTokenCacheKey cacheKey)
 {
     _idTokenContainer.Values.Remove(/*CoreCryptographyHelpers.CreateBase64UrlEncodedSha256Hash(cacheKey)*/ cacheKey.ToString());
 }