JwtBearerAppBuilderExtensions Class

Extension methods to add OpenIdConnect Bearer authentication capabilities to an HTTP application pipeline.

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

Syntax

public class JwtBearerAppBuilderExtensions
class Microsoft.AspNetCore.Builder.JwtBearerAppBuilderExtensions

Methods

UseJwtBearerAuthentication(Microsoft.AspNetCore.Builder.IApplicationBuilder)

Adds the Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware middleware to the specified Microsoft.AspNetCore.Builder.IApplicationBuilder, which enables Bearer token processing capabilities. This middleware understands appropriately formatted and secured tokens which appear in the request header. If the Options.AuthenticationMode is Active, the claims within the bearer token are added to the current request’s IPrincipal User. If the Options.AuthenticationMode is Passive, then the current request is not modified, but IAuthenticationManager AuthenticateAsync may be used at any time to obtain the claims from the request’s bearer token. See also http://tools.ietf.org/html/rfc6749

Arguments:app (Microsoft.AspNetCore.Builder.IApplicationBuilder) – The Microsoft.AspNetCore.Builder.IApplicationBuilder to add the middleware to.
Return type:Microsoft.AspNetCore.Builder.IApplicationBuilder
Returns:A reference to this instance after the operation has completed.
public static IApplicationBuilder UseJwtBearerAuthentication(this IApplicationBuilder app)
UseJwtBearerAuthentication(Microsoft.AspNetCore.Builder.IApplicationBuilder, Microsoft.AspNetCore.Builder.JwtBearerOptions)

Adds the Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware middleware to the specified Microsoft.AspNetCore.Builder.IApplicationBuilder, which enables Bearer token processing capabilities. This middleware understands appropriately formatted and secured tokens which appear in the request header. If the Options.AuthenticationMode is Active, the claims within the bearer token are added to the current request’s IPrincipal User. If the Options.AuthenticationMode is Passive, then the current request is not modified, but IAuthenticationManager AuthenticateAsync may be used at any time to obtain the claims from the request’s bearer token. See also http://tools.ietf.org/html/rfc6749

Arguments:
Return type:

Microsoft.AspNetCore.Builder.IApplicationBuilder

Returns:

A reference to this instance after the operation has completed.

public static IApplicationBuilder UseJwtBearerAuthentication(this IApplicationBuilder app, JwtBearerOptions options)