Open alexeymarkov opened 4 years ago
Does this mean that after this change anonymous endpoints will skip ClaimsPrincipalAuthorizationDefault
?
If so looking forward to this change.
Current behavior doesn't seem right. Why would anonymous endpoint be checked in ClaimsPrincipalAuthorizationDefault
?
This is causing issues if you set up some custom data (like user context) in TokenValidator
and afterwards check it in ClaimsPrincipalAuthorizationDefault
.
Yes, this will be ignore.
Alternatively you can also use a custom IClaimsPrincipalAuthorization implementation and apply it to anonymous endpoints
public class AllowAnonymousClaimsAuthorization : IClaimsPrincipalAuthorization { public Task<bool> IsAuthorized(ClaimsPrincipal claimsPrincipal, string httpVerb, string url) { return Task.FromResult(true); } }
@alexeymarkov Thanks for the tip. Works great!
ClaimsPrincipalAuthorization requires ClaimsPrincipal which is not resolved for AuthorizationLevel.Anonymous. As a consequence ClaimsPrincipal null is passed to ClaimsPrincipalAuthorization:
Change `
`
to `
`