private void RefreshCacheView()
        {
            var tokenCache = App.MsalPublicClient.UserTokenCache;

            var requestContext = new RequestContext(null, new MsalLogger(Guid.NewGuid(), null));

            IDictionary <string, MsalAccessTokenCacheItem> accessTokens = new Dictionary <string, MsalAccessTokenCacheItem>();

            foreach (var accessItemStr in tokenCache.GetAllAccessTokenCacheItems(requestContext))
            {
                MsalAccessTokenCacheItem accessItem = JsonHelper.DeserializeFromJson <MsalAccessTokenCacheItem>(accessItemStr);
                accessTokens.Add(accessItem.GetKey().ToString(), accessItem);
            }
            accessTokenCacheItems.ItemsSource = accessTokens;

            IDictionary <string, MsalRefreshTokenCacheItem> refreshTokens = new Dictionary <string, MsalRefreshTokenCacheItem>();

            foreach (var refreshItemStr in tokenCache.GetAllRefreshTokenCacheItems(requestContext))
            {
                MsalRefreshTokenCacheItem refreshItem = JsonHelper.DeserializeFromJson <MsalRefreshTokenCacheItem>(refreshItemStr);
                refreshTokens.Add(refreshItem.GetKey().ToString(), refreshItem);
            }
            refreshTokenCacheItems.ItemsSource = refreshTokens;

            IDictionary <string, MsalIdTokenCacheItem> idTokens = new Dictionary <string, MsalIdTokenCacheItem>();

            foreach (var idItemStr in tokenCache.GetAllIdTokenCacheItems(requestContext))
            {
                MsalIdTokenCacheItem idItem = JsonHelper.DeserializeFromJson <MsalIdTokenCacheItem>(idItemStr);
                idTokens.Add(idItem.GetKey().ToString(), idItem);
            }
            idTokenCacheItems.ItemsSource = idTokens;

            IDictionary <string, MsalAccountCacheItem> accounts = new Dictionary <string, MsalAccountCacheItem>();

            foreach (var accountStr in tokenCache.GetAllAccountCacheItems(requestContext))
            {
                MsalAccountCacheItem accountItem = JsonHelper.DeserializeFromJson <MsalAccountCacheItem>(accountStr);
                accounts.Add(accountItem.GetKey().ToString(), accountItem);
            }
            accountsCacheItems.ItemsSource = accounts;
        }
コード例 #2
0
 public void DeleteIdToken(MsalIdTokenCacheItem item)
 {
     Delete(item.GetKey().ToString(), _idTokenSharedPreference.Edit());
 }
 public void SaveIdToken(MsalIdTokenCacheItem item)
 {
     Save(item.GetKey(), item.ToJsonString());
 }
        public void SaveIdToken(MsalIdTokenCacheItem item)
        {
            string key = item.GetKey().ToString();

            _idTokenCacheDictionary.AddOrUpdate(key, item, (k, oldValue) => item);
        }
コード例 #5
0
        public void SaveIdToken(MsalIdTokenCacheItem item)
        {
            string key = item.GetKey().ToString();

            _idTokenCacheDictionary[key] = item;
        }
 public void DeleteIdToken(MsalIdTokenCacheItem item)
 {
     Remove(item.GetKey());
 }
コード例 #7
0
 public void SaveIdToken(MsalIdTokenCacheItem item)
 {
     _idTokenCacheDictionary[item.GetKey().ToString()] = item;
 }
 public void SaveIdToken(MsalIdTokenCacheItem item)
 {
     IdTokenCacheDictionary[item.GetKey().ToString()] = JsonHelper.SerializeToJson(item);
 }
コード例 #9
0
        public void SaveIdToken(MsalIdTokenCacheItem item)
        {
            ApplicationDataCompositeValue composite = new ApplicationDataCompositeValue();

            SetCacheValue(composite, JsonHelper.SerializeToJson(item));
            _idTokenContainer.Values[/*CoreCryptographyHelpers.CreateBase64UrlEncodedSha256Hash(cacheKey)*/ item.GetKey().ToString()] = composite;
        }