Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/Http/Authentication.Abstractions/src/TokenExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace Microsoft.AspNetCore.Authentication
/// </summary>
public static class AuthenticationTokenExtensions
{
private static string TokenNamesKey = ".TokenNames";
private static string TokenKeyPrefix = ".Token.";
private const string TokenNamesKey = ".TokenNames";
private const string TokenKeyPrefix = ".Token.";

/// <summary>
/// Stores a set of authentication tokens, after removing any old tokens.
Expand Down Expand Up @@ -76,9 +76,8 @@ public static void StoreTokens(this AuthenticationProperties properties, IEnumer
}

var tokenKey = TokenKeyPrefix + tokenName;
return properties.Items.ContainsKey(tokenKey)
? properties.Items[tokenKey]
: null;

return properties.Items.TryGetValue(tokenKey, out var value) ? value : null;
}

public static bool UpdateTokenValue(this AuthenticationProperties properties, string tokenName, string tokenValue)
Expand Down