Beispiel #1
0
        public MsalAccountCacheItem GetAccount(MsalAccountCacheKey accountKey)
        {
            if (_accountCacheDictionary.TryGetValue(accountKey.ToString(), out var cacheItem))
            {
                return(cacheItem);
            }

            return(null);
        }
        public string GetAccount(MsalAccountCacheKey accountKey)
        {
            var account = accountKey.GetiOSAccountKey();
            var service = accountKey.GetiOSServiceKey();

            var type = AuthorityTypeToAttrType[AuthorityType.MSSTS.ToString()];

            return(GetValue(account, service, type));
        }
        public void DeleteAccount(MsalAccountCacheKey cacheKey)
        {
            var account = cacheKey.GetiOSAccountKey();
            var service = cacheKey.GetiOSServiceKey();

            var type = AuthorityTypeToAttrType[AuthorityType.MSSTS.ToString()];

            Remove(account, service, type);
        }
 public void DeleteAccount(MsalAccountCacheKey cacheKey)
 {
     if (!_accountCacheDictionary.TryRemove(cacheKey.ToString(), out _))
     {
         _logger.InfoPii(
             $"Cannot delete an account because it was already deleted. Key {cacheKey}",
             "Cannot delete an account because it was already deleted");
     }
 }
Beispiel #5
0
        public MsalAccountCacheItem GetAccount(MsalAccountCacheKey accountKey)
        {
            string partitionKey = CacheKeyFactory.GetKeyFromAccount(accountKey);

            AccountCacheDictionary.TryGetValue(partitionKey, out var partition);
            MsalAccountCacheItem cacheItem = null;

            partition?.TryGetValue(accountKey.ToString(), out cacheItem);
            return(cacheItem);
        }
        public void MsalAccountCacheKey()
        {
            MsalAccountCacheKey key = new MsalAccountCacheKey("login.microsoftonline.com", "contoso.com", "uid.utid", "localId");

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

            Assert.AreEqual("uid.utid-login.microsoftonline.com", key.GetiOSAccountKey());
            Assert.AreEqual("contoso.com", key.GetiOSServiceKey());
            Assert.AreEqual("localid", key.GetiOSGenericKey());
        }
        public string GetAccount(MsalAccountCacheKey accountKey)
        {
            var strKey = accountKey.ToString();

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

            return(AccountCacheDictionary[strKey]);
        }
Beispiel #8
0
 public void DeleteAccount(MsalAccountCacheKey cacheKey, RequestContext requestContext)
 {
     using (TelemetryManager.CreateTelemetryHelper(requestContext.TelemetryRequestId, requestContext.ClientId,
                                                   new CacheEvent(CacheEvent.TokenCacheDelete)
     {
         TokenType = CacheEvent.TokenTypes.ACCOUNT
     }))
     {
         DeleteAccount(cacheKey);
     }
 }
Beispiel #9
0
        public string GetAccount(MsalAccountCacheKey accountKey)
        {
            var keyStr = accountKey.ToString();

            if (!_accountContainer.Values.ContainsKey(/*encodedKey*/ keyStr))
            {
                return(null);
            }

            return(CoreHelpers.ByteArrayToString(
                       GetCacheValue((ApplicationDataCompositeValue)_accountContainer.Values[
                                         /*CoreCryptographyHelpers.CreateBase64UrlEncodedSha256Hash(accountKey)*/ keyStr])));
        }
        public void MsalAccountCacheKey()
        {
            var key = new MsalAccountCacheKey(
                "login.microsoftonline.com",
                "contoso.com",
                "uid.utid",
                "localId",
                "AAD");

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

            Assert.AreEqual("uid.utid-login.microsoftonline.com", key.iOSAccount);
            Assert.AreEqual("contoso.com", key.iOSService);
            Assert.AreEqual("localid", key.iOSGeneric);
            Assert.AreEqual(MsalCacheKeys.iOSAuthorityTypeToAttrType["AAD"], key.iOSType);
        }
Beispiel #11
0
 public MsalAccountCacheItem GetAccount(MsalAccountCacheKey accountKey)
 {
     return(MsalAccountCacheItem.FromJsonString(_accountSharedPreference.GetString(accountKey.ToString(), null)));
 }
 public MsalAccountCacheItem GetAccount(MsalAccountCacheKey accountKey)
 {
     return(MsalAccountCacheItem.FromJsonString(GetPayload(accountKey)));
 }
 public void DeleteAccount(MsalAccountCacheKey cacheKey)
 {
     Remove(cacheKey);
 }
Beispiel #14
0
 public void DeleteAccount(MsalAccountCacheKey cacheKey)
 {
     Delete(cacheKey.ToString(), _accountSharedPreference.Edit());
 }
 /// <summary>
 /// This method is not supported for the app token cache because
 /// there are no user accounts in a client credential flow.
 /// </summary>
 public MsalAccountCacheItem GetAccount(MsalAccountCacheKey accountKey)
 {
     throw new NotSupportedException();
 }
Beispiel #16
0
 /// <inheritdoc />
 public string GetAccount(MsalAccountCacheKey accountKey)
 {
     return(_tokenCacheAccessor.GetAccount(accountKey));
 }
Beispiel #17
0
 /// <inheritdoc />
 public void DeleteAccount(MsalAccountCacheKey cacheKey)
 {
     _tokenCacheAccessor.DeleteAccount(cacheKey);
 }
Beispiel #18
0
 public void DeleteAccount(MsalAccountCacheKey cacheKey)
 {
     _accountCacheDictionary.Remove(cacheKey.ToString());
 }
Beispiel #19
0
 public void DeleteAccount(MsalAccountCacheKey cacheKey)
 {
     _accountContainer.Values.Remove(/*CoreCryptographyHelpers.CreateBase64UrlEncodedSha256Hash(cacheKey)*/ cacheKey.ToString());
 }
Beispiel #20
0
 public string GetAccount(MsalAccountCacheKey accountKey)
 {
     return(_accountSharedPreference.GetString(accountKey.ToString(), null));
 }