Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

JwtBearerExtensions.AddJwtBearer Method

Definition

Namespace:
Microsoft.Extensions.DependencyInjection
Assembly:
Microsoft.AspNetCore.Authentication.JwtBearer.dll
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v10.0.0
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v11.0.0-preview.4.26230.115
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v2.0.0
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v2.1.0
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v2.2.0
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v3.0.3
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v3.1.18
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v5.0.9
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v6.0.6
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v7.0.5
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v8.0.19
Package:
Microsoft.AspNetCore.Authentication.JwtBearer v9.0.8

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Name Description
AddJwtBearer(AuthenticationBuilder)

Enables JWT-bearer authentication using the default scheme AuthenticationScheme.

JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header.

AddJwtBearer(AuthenticationBuilder, Action<JwtBearerOptions>)

Enables JWT-bearer authentication using the default scheme AuthenticationScheme.

JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header.

AddJwtBearer(AuthenticationBuilder, String)

Enables JWT-bearer authentication using a pre-defined scheme.

JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header.

AddJwtBearer(AuthenticationBuilder, String, Action<JwtBearerOptions>)

Enables JWT-bearer authentication using the specified scheme.

JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header.

AddJwtBearer(AuthenticationBuilder, String, String, Action<JwtBearerOptions>)

Enables JWT-bearer authentication using the specified scheme.

JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header.

AddJwtBearer(AuthenticationBuilder)

Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs

Enables JWT-bearer authentication using the default scheme AuthenticationScheme.

JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header.

public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder);
static member AddJwtBearer : Microsoft.AspNetCore.Authentication.AuthenticationBuilder -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder
<Extension()>
Public Function AddJwtBearer (builder As AuthenticationBuilder) As AuthenticationBuilder

Parameters

Returns

A reference to builder after the operation has completed.

Applies to

AddJwtBearer(AuthenticationBuilder, Action<JwtBearerOptions>)

Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs

Enables JWT-bearer authentication using the default scheme AuthenticationScheme.

JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header.

public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, Action<Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions> configureOptions);
static member AddJwtBearer : Microsoft.AspNetCore.Authentication.AuthenticationBuilder * Action<Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions> -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder
<Extension()>
Public Function AddJwtBearer (builder As AuthenticationBuilder, configureOptions As Action(Of JwtBearerOptions)) As AuthenticationBuilder

Parameters

configureOptions
Action<JwtBearerOptions>

A delegate that allows configuring JwtBearerOptions.

Returns

A reference to builder after the operation has completed.

Applies to

AddJwtBearer(AuthenticationBuilder, String)

Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs

Enables JWT-bearer authentication using a pre-defined scheme.

JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header.

public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme);
static member AddJwtBearer : Microsoft.AspNetCore.Authentication.AuthenticationBuilder * string -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder
<Extension()>
Public Function AddJwtBearer (builder As AuthenticationBuilder, authenticationScheme As String) As AuthenticationBuilder

Parameters

authenticationScheme
String

The authentication scheme.

Returns

A reference to builder after the operation has completed.

Applies to

AddJwtBearer(AuthenticationBuilder, String, Action<JwtBearerOptions>)

Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs

Enables JWT-bearer authentication using the specified scheme.

JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header.

public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, Action<Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions> configureOptions);
static member AddJwtBearer : Microsoft.AspNetCore.Authentication.AuthenticationBuilder * string * Action<Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions> -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder
<Extension()>
Public Function AddJwtBearer (builder As AuthenticationBuilder, authenticationScheme As String, configureOptions As Action(Of JwtBearerOptions)) As AuthenticationBuilder

Parameters

authenticationScheme
String

The authentication scheme.

configureOptions
Action<JwtBearerOptions>

A delegate that allows configuring JwtBearerOptions.

Returns

A reference to builder after the operation has completed.

Applies to

AddJwtBearer(AuthenticationBuilder, String, String, Action<JwtBearerOptions>)

Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs
Source:
JwtBearerExtensions.cs

Enables JWT-bearer authentication using the specified scheme.

JWT bearer authentication performs authentication by extracting and validating a JWT token from the Authorization request header.

public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, string? displayName, Action<Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions> configureOptions);
public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, string displayName, Action<Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions> configureOptions);
static member AddJwtBearer : Microsoft.AspNetCore.Authentication.AuthenticationBuilder * string * string * Action<Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions> -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder
<Extension()>
Public Function AddJwtBearer (builder As AuthenticationBuilder, authenticationScheme As String, displayName As String, configureOptions As Action(Of JwtBearerOptions)) As AuthenticationBuilder

Parameters

authenticationScheme
String

The authentication scheme.

displayName
String

The display name for the authentication handler.

configureOptions
Action<JwtBearerOptions>

A delegate that allows configuring JwtBearerOptions.

Returns

A reference to builder after the operation has completed.

Applies to


Feedback

Was this page helpful?