I use IdentityServer4 to protect my .Net Core based API. In my API controllers, I need to determine what type of authentication flow (client credential, authorization code, etc.) the client is using. But I can't find it from ClaimsPrincipal or anywhere else. How can I find the flow from API controller?
CodePudding user response:
For WEB.API's in ASP.NET Core you alawys use the AddJwtBearer method in your startup class to protect it. It will look at the incoming request and then if a valid token is found, create a ClaimsPrincipal user.
Then if you are not seeing any claims in the ClaimsPrincipal, then that can depend on many other factors, what does your access token contain? and what ClaimsMapping have you done.