Skip to content

Commit bf3bcce

Browse files
authored
Merge pull request #57 from Azure-Samples/tibre/cacheMethodSwapped
Fixed swapped cache methods
2 parents 7f39714 + 79f604f commit bf3bcce

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

TaskWebApp/Utils/MSALPerUserSessionTokenCache.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ private void UserTokenCacheBeforeWriteNotification(TokenCacheNotificationArgs ar
178178
/// <param name="args">Contains parameters used by the MSAL call accessing the cache.</param>
179179
private void UserTokenCacheAfterAccessNotification(TokenCacheNotificationArgs args)
180180
{
181-
this.LoadUserTokenCacheFromSession();
181+
// if the access operation resulted in a cache update
182+
if (args.HasStateChanged)
183+
{
184+
this.PersistUserTokenCache();
185+
}
182186
}
183187

184188
/// <summary>
@@ -187,11 +191,7 @@ private void UserTokenCacheAfterAccessNotification(TokenCacheNotificationArgs ar
187191
/// <param name="args">Contains parameters used by the MSAL call accessing the cache.</param>
188192
private void UserTokenCacheBeforeAccessNotification(TokenCacheNotificationArgs args)
189193
{
190-
// if the access operation resulted in a cache update
191-
if (args.HasStateChanged)
192-
{
193-
this.PersistUserTokenCache();
194-
}
194+
this.LoadUserTokenCacheFromSession();
195195
}
196196

197197
/// <summary>

0 commit comments

Comments
 (0)