Dela via


OAuthHandler<TOptions> Class

Definition

An authentication handler that supports OAuth.

generic <typename TOptions>
 where TOptions : OAuthOptionspublic ref class OAuthHandler : Microsoft::AspNetCore::Authentication::RemoteAuthenticationHandler<TOptions>
generic <typename TOptions>
 where TOptions : OAuthOptionsgcnew()public ref class OAuthHandler : Microsoft::AspNetCore::Authentication::RemoteAuthenticationHandler<TOptions>
public class OAuthHandler<TOptions> : Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler<TOptions> where TOptions : OAuthOptions
public class OAuthHandler<TOptions> : Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler<TOptions> where TOptions : OAuthOptions, new()
type OAuthHandler<'Options (requires 'Options :> OAuthOptions)> = class
    inherit RemoteAuthenticationHandler<'Options (requires 'Options :> OAuthOptions)>
type OAuthHandler<'Options (requires 'Options :> OAuthOptions and 'Options : (new : unit -> 'Options))> = class
    inherit RemoteAuthenticationHandler<'Options (requires 'Options :> OAuthOptions and 'Options : (new : unit -> 'Options))>
Public Class OAuthHandler(Of TOptions)
Inherits RemoteAuthenticationHandler(Of TOptions)

Type Parameters

TOptions

The type of options.

Inheritance
Derived

Constructors

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

Initializes a new instance of OAuthHandler<TOptions>.

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

Initializes a new instance of OAuthHandler<TOptions>.

Properties

Backchannel

Gets the HttpClient instance used to communicate with the remote authentication provider.

ChallengeCalled (Inherited from AuthenticationHandler<TOptions>)
ClaimsIssuer

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

(Inherited from AuthenticationHandler<TOptions>)
Clock
Obsolete.

Gets the ISystemClock.

(Inherited from AuthenticationHandler<TOptions>)
Context

Gets or sets the HttpContext.

(Inherited from AuthenticationHandler<TOptions>)
CurrentUri

Gets the absolute current url.

(Inherited from AuthenticationHandler<TOptions>)
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.

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.

(Inherited from RemoteAuthenticationHandler<TOptions>)
InitializeResult (Inherited from AuthenticationHandler<TOptions>)
Logger

Gets the ILogger.

(Inherited from AuthenticationHandler<TOptions>)
Options

Gets or sets the options associated with this authentication handler.

(Inherited from AuthenticationHandler<TOptions>)
OptionsMonitor

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

(Inherited from AuthenticationHandler<TOptions>)
OriginalPath

Gets the path as seen by the authentication middleware.

(Inherited from AuthenticationHandler<TOptions>)
OriginalPathBase

Gets the path base as seen by the authentication middleware.

(Inherited from AuthenticationHandler<TOptions>)
PriorHandler (Inherited from AuthenticationHandler<TOptions>)
Request

Gets the HttpRequest associated with the current request.

(Inherited from AuthenticationHandler<TOptions>)
Response

Gets the HttpResponse associated with the current request.

(Inherited from AuthenticationHandler<TOptions>)
Scheme

Gets or sets the AuthenticationScheme associated with this authentication handler.

(Inherited from AuthenticationHandler<TOptions>)
SignInAccepted (Inherited from AuthenticationHandler<TOptions>)
SignInScheme

The authentication scheme used by default for signin.

(Inherited from RemoteAuthenticationHandler<TOptions>)
SignOutAccepted (Inherited from AuthenticationHandler<TOptions>)
TimeProvider

Gets the current time, primarily for unit testing.

(Inherited from AuthenticationHandler<TOptions>)
UrlEncoder

Gets the UrlEncoder.

(Inherited from AuthenticationHandler<TOptions>)

Methods

AuthenticateAsync()

Authenticate the current request.

(Inherited from AuthenticationHandler<TOptions>)
AuthenticateAsync(AuthenticateContext) (Inherited from AuthenticationHandler<TOptions>)
BuildChallengeUrl(AuthenticationProperties, String)

Constructs the OAuth challenge url.

BuildChallengeUrl(AuthenticationProperties, String)
BuildRedirectUri(String)

Constructs an absolute url for the specified targetPath.

(Inherited from AuthenticationHandler<TOptions>)
ChallengeAsync(AuthenticationProperties)

Challenge the current request.

(Inherited from AuthenticationHandler<TOptions>)
ChallengeAsync(ChallengeContext) (Inherited from AuthenticationHandler<TOptions>)
CreateEventsAsync()

Creates a new instance of the events instance.

CreateEventsAsync()

Creates a new instance of the events instance.

(Inherited from RemoteAuthenticationHandler<TOptions>)
CreateTicketAsync(ClaimsIdentity, AuthenticationProperties, OAuthTokenResponse)
CreateTicketAsync(ClaimsIdentity, AuthenticationProperties, OAuthTokenResponse)

Creates an AuthenticationTicket from the specified tokens.

ExchangeCodeAsync(OAuthCodeExchangeContext)

Exchanges the authorization code for a authorization token from the remote provider.

ExchangeCodeAsync(String, String)
FinishResponseAsync()

Hook that is called when the response about to be sent

(Inherited from AuthenticationHandler<TOptions>)
ForbidAsync(AuthenticationProperties)

Forbid the current request.

(Inherited from AuthenticationHandler<TOptions>)
FormatScope()

Format the Scope property.

FormatScope(IEnumerable<String>)

Format a list of OAuth scopes.

GenerateCorrelationId(AuthenticationProperties)

Produces a cookie containing a nonce used to correlate the current remote authentication request.

(Inherited from RemoteAuthenticationHandler<TOptions>)
GenerateCorrelationId(AuthenticationProperties) (Inherited from RemoteAuthenticationHandler<TOptions>)
GetDescriptions(DescribeSchemesContext) (Inherited from AuthenticationHandler<TOptions>)
HandleAccessDeniedErrorAsync(AuthenticationProperties)

Derived types may override this method to handle access denied errors.

(Inherited from RemoteAuthenticationHandler<TOptions>)
HandleAuthenticateAsync()

Allows derived types to handle authentication.

(Inherited from RemoteAuthenticationHandler<TOptions>)
HandleAuthenticateOnceAsync()

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

(Inherited from AuthenticationHandler<TOptions>)
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.

(Inherited from AuthenticationHandler<TOptions>)
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.)

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.)

(Inherited from AuthenticationHandler<TOptions>)
HandleForbiddenAsync(AuthenticationProperties)

Override this method to handle Forbid.

(Inherited from RemoteAuthenticationHandler<TOptions>)
HandleForbiddenAsync(ChallengeContext) (Inherited from RemoteAuthenticationHandler<TOptions>)
HandleRemoteAuthenticateAsync()

Authenticate the user identity with the identity provider.

The method process the request on the endpoint defined by CallbackPath.

HandleRemoteCallbackAsync() (Inherited from RemoteAuthenticationHandler<TOptions>)
HandleRequestAsync()

Handles the current authentication request.

(Inherited from RemoteAuthenticationHandler<TOptions>)
HandleSignInAsync(SignInContext) (Inherited from RemoteAuthenticationHandler<TOptions>)
HandleSignOutAsync(SignOutContext) (Inherited from RemoteAuthenticationHandler<TOptions>)
HandleUnauthorizedAsync(ChallengeContext)
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.)

(Inherited from AuthenticationHandler<TOptions>)
InitializeAsync(AuthenticationScheme, HttpContext)

Initialize the handler, resolve the options and validate them.

(Inherited from AuthenticationHandler<TOptions>)
InitializeAsync(TOptions, HttpContext, ILogger, UrlEncoder)

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

(Inherited from AuthenticationHandler<TOptions>)
InitializeEventsAsync()

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

(Inherited from AuthenticationHandler<TOptions>)
InitializeHandlerAsync()

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

(Inherited from AuthenticationHandler<TOptions>)
ResolveTarget(String)

Resolves the scheme that this authentication operation is forwarded to.

(Inherited from AuthenticationHandler<TOptions>)
ShouldHandleRequestAsync()

Gets a value that determines if the current authentication request should be handled by HandleRequestAsync().

(Inherited from RemoteAuthenticationHandler<TOptions>)
ShouldHandleScheme(String, Boolean) (Inherited from AuthenticationHandler<TOptions>)
SignInAsync(SignInContext) (Inherited from AuthenticationHandler<TOptions>)
SignOutAsync(SignOutContext) (Inherited from AuthenticationHandler<TOptions>)
ValidateCorrelationId(AuthenticationProperties)

Validates that the current request correlates with the current remote authentication request.

(Inherited from RemoteAuthenticationHandler<TOptions>)
ValidateCorrelationId(AuthenticationProperties) (Inherited from RemoteAuthenticationHandler<TOptions>)

Applies to