Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​AspNetCore.​Authentication.​AuthenticationTokenExtensions
Assembly: Microsoft.AspNetCore.Authentication.Abstractions
Inheritance: object → AuthenticationTokenExtensions
Extension methods for storing authentication tokens in <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> .
Methods
public static
void
StoreTokens​(AuthenticationProperties properties,
System.​Collections.​Generic.​IEnumerable<​AuthenticationToken> tokens)
Stores a set of authentication tokens, after removing any old tokens.
properties
The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
tokens
The tokens to store.
public static
string
GetTokenValue​(AuthenticationProperties properties,
string tokenName)
Returns the value of a token.
Returns The token value.
properties
The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
tokenName
The token name.
public static
bool
UpdateTokenValue​(AuthenticationProperties properties,
string tokenName,
string tokenValue)
Updates the value of a token if already present.
Returns <see langword="true" /> if the token was updated, otherwise <see langword="false" /> .
properties
The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> to update.
tokenName
The token name.
tokenValue
The token value. May be <c>null</c> .
public static
System.​Collections.​Generic.​IEnumerable<​AuthenticationToken>
GetTokens​(AuthenticationProperties properties)
Returns all of the <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationToken" /> instances contained in the properties.
Returns The authentication tokens.
properties
The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
public static
System.​Threading.​Tasks.​Task<​string>
GetTokenAsync​(IAuthenticationService auth,
Http.​HttpContext context,
string tokenName)
Authenticates the request using the specified authentication scheme and returns the value for the token.
Returns The value of the token if present.
auth
The <see cref="T:Microsoft.AspNetCore.Authentication.IAuthenticationService" /> .
context
The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
tokenName
The name of the token.
public static
System.​Threading.​Tasks.​Task<​string>
GetTokenAsync​(IAuthenticationService auth,
Http.​HttpContext context,
string scheme,
string tokenName)
Authenticates the request using the specified authentication scheme and returns the value for the token.
Returns The value of the token if present.
auth
The <see cref="T:Microsoft.AspNetCore.Authentication.IAuthenticationService" /> .
context
The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme
The name of the authentication scheme.
tokenName
The name of the token.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object