JwtBearerEvents Class

Specifies events which the Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware invokes to enable developer control over the authentication process.

Namespace
Microsoft.AspNetCore.Authentication.JwtBearer
Assemblies
  • Microsoft.AspNetCore.Authentication.JwtBearer

Syntax

public class JwtBearerEvents : IJwtBearerEvents
class Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerEvents

Methods

AuthenticationFailed(Microsoft.AspNetCore.Authentication.JwtBearer.AuthenticationFailedContext)
Return type:System.Threading.Tasks.Task
public virtual Task AuthenticationFailed(AuthenticationFailedContext context)
Challenge(Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerChallengeContext)
Return type:System.Threading.Tasks.Task
public virtual Task Challenge(JwtBearerChallengeContext context)
MessageReceived(Microsoft.AspNetCore.Authentication.JwtBearer.MessageReceivedContext)
Return type:System.Threading.Tasks.Task
public virtual Task MessageReceived(MessageReceivedContext context)
TokenValidated(Microsoft.AspNetCore.Authentication.JwtBearer.TokenValidatedContext)
Return type:System.Threading.Tasks.Task
public virtual Task TokenValidated(TokenValidatedContext context)

Properties

Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerEvents.OnAuthenticationFailed

Invoked if exceptions are thrown during request processing. The exceptions will be re-thrown after this event unless suppressed.

Return type:System.Func<Microsoft.AspNetCore.Authentication.JwtBearer.AuthenticationFailedContext>
public Func<AuthenticationFailedContext, Task> OnAuthenticationFailed { get; set; }
Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerEvents.OnChallenge

Invoked before a challenge is sent back to the caller.

Return type:System.Func<Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerChallengeContext>
public Func<JwtBearerChallengeContext, Task> OnChallenge { get; set; }
Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerEvents.OnMessageReceived

Invoked when a protocol message is first received.

Return type:System.Func<Microsoft.AspNetCore.Authentication.JwtBearer.MessageReceivedContext>
public Func<MessageReceivedContext, Task> OnMessageReceived { get; set; }
Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerEvents.OnTokenValidated

Invoked after the security token has passed validation and a ClaimsIdentity has been generated.

Return type:System.Func<Microsoft.AspNetCore.Authentication.JwtBearer.TokenValidatedContext>
public Func<TokenValidatedContext, Task> OnTokenValidated { get; set; }