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 account = idTokenKey.GetiOSAccountKey(); var service = idTokenKey.GetiOSServiceKey(); var type = (int)CredentialAttrType.IdToken; return(GetValue(account, service, type)); }
public void DeleteIdToken(MsalIdTokenCacheKey cacheKey) { var account = cacheKey.GetiOSAccountKey(); var service = cacheKey.GetiOSServiceKey(); var type = (int)CredentialAttrType.IdToken; Remove(account, service, type); }
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()); }
public string GetIdToken(MsalIdTokenCacheKey idTokenKey) { var strKey = idTokenKey.ToString(); if (!IdTokenCacheDictionary.ContainsKey(strKey)) { return(null); } return(IdTokenCacheDictionary[strKey]); }
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 DeleteIdToken(MsalIdTokenCacheKey cacheKey, RequestContext requestContext) { using (TelemetryManager.CreateTelemetryHelper(requestContext.TelemetryRequestId, requestContext.ClientId, new CacheEvent(CacheEvent.TokenCacheDelete) { TokenType = CacheEvent.TokenTypes.ID })) { DeleteIdToken(cacheKey); } }
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]))); }
public MsalIdTokenCacheItem GetIdToken(MsalIdTokenCacheKey idTokenKey) { return(MsalIdTokenCacheItem.FromJsonString(GetPayload(idTokenKey))); }
MsalIdTokenCacheItem ITokenCacheInternal.GetIdTokenCacheItem(MsalIdTokenCacheKey msalIdTokenCacheKey) { var idToken = _accessor.GetIdToken(msalIdTokenCacheKey); return(idToken); }
public void DeleteIdToken(MsalIdTokenCacheKey cacheKey) { Delete(cacheKey.ToString(), _idTokenSharedPreference.Edit()); }
public void DeleteIdToken(MsalIdTokenCacheKey cacheKey) { Remove(cacheKey); }
/// <inheritdoc /> public string GetIdToken(MsalIdTokenCacheKey idTokenKey) { return(_tokenCacheAccessor.GetIdToken(idTokenKey)); }
public MsalIdTokenCacheItem GetIdToken(MsalIdTokenCacheKey idTokenKey) { return(MsalIdTokenCacheItem.FromJsonString(_idTokenSharedPreference.GetString(idTokenKey.ToString(), null))); }
/// <inheritdoc /> public void DeleteIdToken(MsalIdTokenCacheKey cacheKey) { _tokenCacheAccessor.DeleteIdToken(cacheKey); }
async Task <MsalIdTokenCacheItem> ITokenCacheInternal.GetIdTokenCacheItemAsync(MsalIdTokenCacheKey msalIdTokenCacheKey, RequestContext requestContext) { await _semaphoreSlim.WaitAsync().ConfigureAwait(false); try { TokenCacheNotificationArgs args = new TokenCacheNotificationArgs(this, ClientId, null, false); await OnBeforeAccessAsync(args).ConfigureAwait(false); try { var idToken = _accessor.GetIdToken(msalIdTokenCacheKey); return(idToken); } finally { await OnAfterAccessAsync(args).ConfigureAwait(false); } } finally { _semaphoreSlim.Release(); } }
public void DeleteIdToken(MsalIdTokenCacheKey cacheKey) { _idTokenCacheDictionary.Remove(cacheKey.ToString()); }
public void DeleteIdToken(MsalIdTokenCacheKey cacheKey) { _idTokenContainer.Values.Remove(/*CoreCryptographyHelpers.CreateBase64UrlEncodedSha256Hash(cacheKey)*/ cacheKey.ToString()); }
public string GetIdToken(MsalIdTokenCacheKey idTokenKey) { return(_idTokenSharedPreference.GetString(idTokenKey.ToString(), null)); }