user17686011
user17686011

Reputation:

Using multiple JWT Scheme in ASP.NET core

I wonder how ASP.NET core behaves when there are multiple JWT schemes in project. Does it challenges all the schemes ? If yes how can I get the scheme name (in my controller function) in where the challenge was successful ?

Upvotes: 0

Views: 1340

Answers (1)

Ruikai Feng
Ruikai Feng

Reputation: 11631

I think you could read the offcial document related:

https://learn.microsoft.com/en-us/aspnet/core/security/authorization/limitingidentitybyscheme?view=aspnetcore-6.0#selecting-the-scheme-with-the-authorize-attribute

and try as the document:

[Authorize(AuthenticationSchemes = AuthSchemes)]
public class MixedController : Controller
{
    ......
    private const string AuthSchemes = "SomeName,AnotherName" 
        
   .....

}

Upvotes: 0

Related Questions