-
Notifications
You must be signed in to change notification settings - Fork 245
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Microsoft.Identity.Web Library
Microsoft.Identity.Web
Microsoft.Identity.Web version
1.26.0
Web app
Not Applicable
Web API
Protected web APIs (validating tokens)
Token cache serialization
In-memory caches
Description
If I add groups as optional claims with option "Emit groups as role claims" in AzureAd Token Configuration, the resulting token for a client credential flow / confidentialClientApplication might have no roles[] claim.
When sending this token to a web-api which just "RequiresAuthenticatedUser()" the httpContext.User is not populated by the authentication middleware although I can see a valid ClaimsPrincipal within OnTokenValidated=>context.Principal.
As a result, Authorization fails.
Reproduction steps
- Setup AzureAd AppRegistration with optional claims "groups" and "emit groups as role claims". (do not assign any groups to the corresponding serivce principal which calls this api at the end)
- In code "aquireTokenAsApp"
- call Api
- =>User not authenticated
Error message
Authorize-Policy => Failure => Do not allow anonymous user
Id Web logs
Relevant code snippets
---Regression
No response
Expected behavior
Even if a token is missing role claims, the confidentialClient should still get authenticated.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested