private static bool RemoveFromDictionary(TokenCache tokenCache, TokenCacheKey key) { tokenCache.OnBeforeAccess(new TokenCacheNotificationArgs {TokenCache = tokenCache}); tokenCache.OnBeforeWrite(new TokenCacheNotificationArgs {TokenCache = tokenCache}); bool result = tokenCache.tokenCacheDictionary.Remove(key); tokenCache.HasStateChanged = true; tokenCache.OnAfterAccess(new TokenCacheNotificationArgs {TokenCache = tokenCache}); return result; }
private static void AddToDictionary(TokenCache tokenCache, TokenCacheKey key, AuthenticationResultEx value) { tokenCache.OnBeforeAccess(new TokenCacheNotificationArgs {TokenCache = tokenCache}); tokenCache.OnBeforeWrite(new TokenCacheNotificationArgs {TokenCache = tokenCache}); tokenCache.tokenCacheDictionary.Add(key, value); tokenCache.HasStateChanged = true; tokenCache.OnAfterAccess(new TokenCacheNotificationArgs {TokenCache = tokenCache}); }