Skip to content

Commit 29fb627

Browse files
authored
Merge pull request #185 from ryancyq/patch-7
Custom Jwt AuthencationScheme
2 parents d9ecb9c + 70b47cc commit 29fb627

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Core/Authentication/JwtBearer/JwtTokenMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ namespace AbpCompanyName.AbpProjectName.Authentication.JwtBearer
66
{
77
public static class JwtTokenMiddleware
88
{
9-
public static IApplicationBuilder UseJwtTokenMiddleware(this IApplicationBuilder app)
9+
public static IApplicationBuilder UseJwtTokenMiddleware(this IApplicationBuilder app, string schema = JwtBearerDefaults.AuthenticationScheme)
1010
{
1111
return app.Use(async (ctx, next) =>
1212
{
1313
if (ctx.User.Identity?.IsAuthenticated != true)
1414
{
15-
var result = await ctx.AuthenticateAsync(JwtBearerDefaults.AuthenticationScheme);
15+
var result = await ctx.AuthenticateAsync(schema);
1616
if (result.Succeeded && result.Principal != null)
1717
{
1818
ctx.User = result.Principal;

0 commit comments

Comments
 (0)