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.​AuthenticationHttpContextExtensions

Assembly: Microsoft.AspNetCore.Authentication.Abstractions

Inheritance: object → AuthenticationHttpContextExtensions

Extension methods to expose Authentication on HttpContext.

Methods

AuthenticateAsync​(Http.​HttpContext context)
Authenticate the current request using the default authentication scheme. The default authentication scheme can be configured using <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationOptions.DefaultAuthenticateScheme" /> .
Returns The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticateResult" /> .
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
AuthenticateAsync​(Http.​HttpContext context, string scheme)
Authenticate the current request using the specified scheme.
Returns The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticateResult" /> .
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme The name of the authentication scheme.
ChallengeAsync​(Http.​HttpContext context, string scheme)
Challenge the current request using the specified scheme. An authentication challenge can be issued when an unauthenticated user requests an endpoint that requires authentication.
Returns The result.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme The name of the authentication scheme.
ChallengeAsync​(Http.​HttpContext context)
Challenge the current request using the default challenge scheme. An authentication challenge can be issued when an unauthenticated user requests an endpoint that requires authentication. The default challenge scheme can be configured using <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationOptions.DefaultChallengeScheme" /> .
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
ChallengeAsync​(Http.​HttpContext context, AuthenticationProperties? properties)
Challenge the current request using the default challenge scheme. An authentication challenge can be issued when an unauthenticated user requests an endpoint that requires authentication. The default challenge scheme can be configured using <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationOptions.DefaultChallengeScheme" /> .
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
properties The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
ChallengeAsync​(Http.​HttpContext context, string scheme, AuthenticationProperties? properties)
Challenge the current request using the specified scheme. An authentication challenge can be issued when an unauthenticated user requests an endpoint that requires authentication.
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme The name of the authentication scheme.
properties The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
ForbidAsync​(Http.​HttpContext context, string scheme)
Forbid the current request using the specified scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access.
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme The name of the authentication scheme.
ForbidAsync​(Http.​HttpContext context)
Forbid the current request using the default forbid scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access. The default forbid scheme can be configured using <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationOptions.DefaultForbidScheme" /> .
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
ForbidAsync​(Http.​HttpContext context, AuthenticationProperties? properties)
Forbid the current request using the default forbid scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access. The default forbid scheme can be configured using <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationOptions.DefaultForbidScheme" /> .
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
properties The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
ForbidAsync​(Http.​HttpContext context, string scheme, AuthenticationProperties? properties)
Forbid the current request using the specified scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access.
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme The name of the authentication scheme.
properties The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
SignInAsync​(Http.​HttpContext context, string scheme, System.​Security.​Claims.​ClaimsPrincipal principal)
Sign in a principal for the specified scheme.
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme The name of the authentication scheme.
principal The user.
SignInAsync​(Http.​HttpContext context, System.​Security.​Claims.​ClaimsPrincipal principal)
Sign in a principal for the default authentication scheme. The default scheme for signing in can be configured using <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationOptions.DefaultSignInScheme" /> .
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
principal The user.
SignInAsync​(Http.​HttpContext context, System.​Security.​Claims.​ClaimsPrincipal principal, AuthenticationProperties? properties)
Sign in a principal for the default authentication scheme. The default scheme for signing in can be configured using <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationOptions.DefaultSignInScheme" /> .
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
principal The user.
properties The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
SignInAsync​(Http.​HttpContext context, string scheme, System.​Security.​Claims.​ClaimsPrincipal principal, AuthenticationProperties? properties)
Sign in a principal for the specified scheme.
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme The name of the authentication scheme.
principal The user.
properties The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
SignOutAsync​(Http.​HttpContext context)
Sign out a principal for the default authentication scheme. The default scheme for signing out can be configured using <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationOptions.DefaultSignOutScheme" /> .
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
SignOutAsync​(Http.​HttpContext context, AuthenticationProperties? properties)
Sign out a principal for the default authentication scheme. The default scheme for signing out can be configured using <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationOptions.DefaultSignOutScheme" /> .
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
properties The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
SignOutAsync​(Http.​HttpContext context, string scheme)
Sign out a principal for the specified scheme.
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme The name of the authentication scheme.
SignOutAsync​(Http.​HttpContext context, string scheme, AuthenticationProperties? properties)
Sign out a principal for the specified scheme.
Returns The task.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme The name of the authentication scheme.
properties The <see cref="T:Microsoft.AspNetCore.Authentication.AuthenticationProperties" /> properties.
public static System.​Threading.​Tasks.​Task<​string>
GetTokenAsync​(Http.​HttpContext context, string scheme, string tokenName)
Authenticates the request using the specified scheme and returns the value for the token.
Returns The value of the token if present.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
scheme The name of the authentication scheme.
tokenName The name of the token.
public static System.​Threading.​Tasks.​Task<​string>
GetTokenAsync​(Http.​HttpContext context, string tokenName)
Authenticates the request using the default authentication scheme and returns the value for the token. The default authentication scheme can be configured using <see cref="P:Microsoft.AspNetCore.Authentication.AuthenticationOptions.DefaultAuthenticateScheme" /> .
Returns The value of the token if present.
context The <see cref="T:Microsoft.AspNetCore.Http.HttpContext" /> context.
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
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object