public void DeleteAccessToken(MsalAccessTokenCacheKey cacheKey) { if (!_accessTokenCacheDictionary.TryRemove(cacheKey.ToString(), out _)) { _logger.InfoPii( $"Cannot delete an access token because it was already deleted. Key {cacheKey}", "Cannot delete an access token because it was already deleted"); } }
public MsalAccessTokenCacheItem GetAccessToken(MsalAccessTokenCacheKey accessTokenKey) { if (_accessTokenCacheDictionary.TryGetValue(accessTokenKey.ToString(), out var cacheItem)) { return(cacheItem); } return(null); }
public string GetAccessToken(MsalAccessTokenCacheKey accessTokenKey) { var strKey = accessTokenKey.ToString(); if (!AccessTokenCacheDictionary.ContainsKey(strKey)) { return(null); } return(AccessTokenCacheDictionary[strKey]); }
public void DeleteAccessToken(MsalAccessTokenCacheKey cacheKey) { Delete(cacheKey.ToString(), _accessTokenSharedPreference.Edit()); }
public MsalAccessTokenCacheItem GetAccessToken(MsalAccessTokenCacheKey accessTokenKey) { return(MsalAccessTokenCacheItem.FromJsonString(_accessTokenSharedPreference.GetString(accessTokenKey.ToString(), null))); }
public void MsalAccessTokenCacheKey() { var key = new MsalAccessTokenCacheKey("login.microsoftonline.com", "contoso.com", "uid.utid", "clientid", "user.read user.write"); Assert.AreEqual("uid.utid-login.microsoftonline.com-accesstoken-clientid-contoso.com-user.read user.write", key.ToString()); Assert.AreEqual("uid.utid-login.microsoftonline.com", key.iOSAccount); Assert.AreEqual("accesstoken-clientid-contoso.com-user.read user.write", key.iOSService); Assert.AreEqual("accesstoken-clientid-contoso.com", key.iOSGeneric); Assert.AreEqual((int)MsalCacheKeys.iOSCredentialAttrType.AccessToken, key.iOSType); }
public MsalAccessTokenCacheItem GetAccessToken(MsalAccessTokenCacheKey accessTokenKey) { _accessTokenCacheDictionary.TryGetValue(accessTokenKey.ToString(), out MsalAccessTokenCacheItem cacheItem); return(cacheItem); }
public void MsalAccessTokenCacheKey() { MsalAccessTokenCacheKey key = new MsalAccessTokenCacheKey("login.microsoftonline.com", "contoso.com", "uid.utid", "clientid", "user.read user.write"); Assert.AreEqual("uid.utid-login.microsoftonline.com-accesstoken-clientid-contoso.com-user.read user.write", key.ToString()); Assert.AreEqual("uid.utid-login.microsoftonline.com", key.GetiOSAccountKey()); Assert.AreEqual("accesstoken-clientid-contoso.com-user.read user.write", key.GetiOSServiceKey()); Assert.AreEqual("accesstoken-clientid-contoso.com", key.GetiOSGenericKey()); Assert.AreEqual("uid.utid-login.microsoftonline.com-accesstoken-clientid-contoso.com-n5wvhdusof/wfsjgk1muxrk89nwfynymsl4qefkynbu=", key.GetUWPFixedSizeKey()); }
public string GetAccessToken(MsalAccessTokenCacheKey accessTokenKey) { return(_accessTokenSharedPreference.GetString(accessTokenKey.ToString(), null)); }
public void DeleteAccessToken(MsalAccessTokenCacheKey cacheKey) { _accessTokenCacheDictionary.Remove(cacheKey.ToString()); }