Produce 403 from custom AuthenticationHandler.HandleAuthenticateAsync
#61323
Unanswered
maxkoshevoi
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm writing a custom authentication handler since the token I have is not standard. I've added my token validation logic to
HandleAuthenticateAsync
and returnAuthenticateResult.Fail("[reason]")
when some part of validation fails.The token has
Aud
claim that stores audience, and I want to fail with 403 if token is valid, but audience isn't.The only way I was able to do that is like this:
AuthenticationProperties
? I can specify them inAuthenticateResult.Fail
, but they come out empty inHandleChallengeAsync
HandleAuthenticateAsync
? I know the name of the method suggests we should only do authentication there, but we still need to fail it in order to get toHandleChallengeAsync
which is also not correct since authentication was successful, it's the authorization that's failedBeta Was this translation helpful? Give feedback.
All reactions