Add UpdateTokenValue API
This commit is contained in:
parent
c16fc06cb9
commit
2a6ab2be8c
|
|
@ -63,6 +63,26 @@ namespace Microsoft.AspNetCore.Authentication
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool UpdateTokenValue(this AuthenticationProperties properties, string tokenName, string tokenValue)
|
||||||
|
{
|
||||||
|
if (properties == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(properties));
|
||||||
|
}
|
||||||
|
if (tokenName == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(tokenName));
|
||||||
|
}
|
||||||
|
|
||||||
|
var tokenKey = TokenKeyPrefix + tokenName;
|
||||||
|
if (!properties.Items.ContainsKey(tokenKey))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
properties.Items[tokenKey] = tokenValue;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static IEnumerable<AuthenticationToken> GetTokens(this AuthenticationProperties properties)
|
public static IEnumerable<AuthenticationToken> GetTokens(this AuthenticationProperties properties)
|
||||||
{
|
{
|
||||||
if (properties == null)
|
if (properties == null)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue