Delen via


AuthenticationHandler<TOptions> Class

Definition

An opinionated abstraction for implementing IAuthenticationHandler.

generic <typename TOptions>
 where TOptions : AuthenticationOptionspublic ref class AuthenticationHandler abstract : Microsoft::AspNetCore::Http::Features::Authentication::IAuthenticationHandler
generic <typename TOptions>
 where TOptions : AuthenticationSchemeOptionsgcnew()public ref class AuthenticationHandler abstract : Microsoft::AspNetCore::Authentication::IAuthenticationHandler
public abstract class AuthenticationHandler<TOptions> : Microsoft.AspNetCore.Http.Features.Authentication.IAuthenticationHandler where TOptions : AuthenticationOptions
public abstract class AuthenticationHandler<TOptions> : Microsoft.AspNetCore.Authentication.IAuthenticationHandler where TOptions : AuthenticationSchemeOptions, new()
type AuthenticationHandler<'Options (requires 'Options :> AuthenticationOptions)> = class
    interface IAuthenticationHandler
type AuthenticationHandler<'Options (requires 'Options :> AuthenticationSchemeOptions and 'Options : (new : unit -> 'Options))> = class
    interface IAuthenticationHandler
Public MustInherit Class AuthenticationHandler(Of TOptions)
Implements IAuthenticationHandler

Type Parameters

TOptions

The type for the options used to configure the authentication handler.

Inheritance
AuthenticationHandler<TOptions>
Derived
Implements

Constructors

AuthenticationHandler<TOptions>()
AuthenticationHandler<TOptions>(IOptionsMonitor<TOptions>, ILoggerFactory, UrlEncoder, ISystemClock)
Obsolete.

Initializes a new instance of AuthenticationHandler<TOptions>.

AuthenticationHandler<TOptions>(IOptionsMonitor<TOptions>, ILoggerFactory, UrlEncoder)

Initializes a new instance of AuthenticationHandler<TOptions>.

Properties

ChallengeCalled
ClaimsIssuer

Gets the issuer that should be used when any claims are issued.

Clock
Obsolete.

Gets the ISystemClock.

Context

Gets or sets the HttpContext.

CurrentUri

Gets the absolute current url.

Events

The handler calls methods on the events which give the application control at certain points where processing is occurring. If it is not provided a default instance is supplied which does nothing when the methods are called.

InitializeResult
Logger

Gets the ILogger.

Options

Gets or sets the options associated with this authentication handler.

OptionsMonitor

Gets the IOptionsMonitor<TOptions> to detect changes to options.

OriginalPath

Gets the path as seen by the authentication middleware.

OriginalPathBase

Gets the path base as seen by the authentication middleware.

PriorHandler
Request

Gets the HttpRequest associated with the current request.

Response

Gets the HttpResponse associated with the current request.

Scheme

Gets or sets the AuthenticationScheme associated with this authentication handler.

SignInAccepted
SignOutAccepted
TimeProvider

Gets the current time, primarily for unit testing.

UrlEncoder

Gets the UrlEncoder.

Methods

AuthenticateAsync()

Authenticate the current request.

AuthenticateAsync(AuthenticateContext)
BuildRedirectUri(String)

Constructs an absolute url for the specified targetPath.

ChallengeAsync(AuthenticationProperties)

Challenge the current request.

ChallengeAsync(ChallengeContext)
CreateEventsAsync()

Creates a new instance of the events instance.

FinishResponseAsync()

Hook that is called when the response about to be sent

ForbidAsync(AuthenticationProperties)

Forbid the current request.

GetDescriptions(DescribeSchemesContext)
HandleAuthenticateAsync()

Allows derived types to handle authentication.

HandleAuthenticateOnceAsync()

Used to ensure HandleAuthenticateAsync is only invoked once. The subsequent calls will return the same authenticate result.

HandleAuthenticateOnceSafeAsync()

Used to ensure HandleAuthenticateAsync is only invoked once safely. The subsequent calls will return the same authentication result. Any exceptions will be converted into a failed authentication result containing the exception.

HandleChallengeAsync(AuthenticationProperties)

Override this method to deal with 401 challenge concerns, if an authentication scheme in question deals an authentication interaction as part of it's request flow. (like adding a response header, or changing the 401 result to 302 of a login page or external sign-in location.)

HandleForbiddenAsync(AuthenticationProperties)

Override this method to handle Forbid.

HandleForbiddenAsync(ChallengeContext)

Override this method to deal with a challenge that is forbidden.

HandleRequestAsync()

Called once by common code after initialization. If an authentication middleware responds directly to specifically known paths it must override this virtual, compare the request path to it's known paths, provide any response information as appropriate, and true to stop further processing.

HandleSignInAsync(SignInContext)
HandleSignOutAsync(SignOutContext)
HandleUnauthorizedAsync(ChallengeContext)

Override this method to deal with 401 challenge concerns, if an authentication scheme in question deals an authentication interaction as part of it's request flow. (like adding a response header, or changing the 401 result to 302 of a login page or external sign-in location.)

InitializeAsync(AuthenticationScheme, HttpContext)

Initialize the handler, resolve the options and validate them.

InitializeAsync(TOptions, HttpContext, ILogger, UrlEncoder)

Initialize is called once per request to contextualize this instance with appropriate state.

InitializeEventsAsync()

Initializes the events object, called once per request by InitializeAsync(AuthenticationScheme, HttpContext).

InitializeHandlerAsync()

Called after options/events have been initialized for the handler to finish initializing itself.

ResolveTarget(String)

Resolves the scheme that this authentication operation is forwarded to.

ShouldHandleScheme(String, Boolean)
SignInAsync(SignInContext)
SignOutAsync(SignOutContext)

Applies to