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
Uh oh!
There was an error while loading. Please reload this page.
-
I'm writing a custom authentication handler since the token I have is not standard. I've added my token validation logic to
HandleAuthenticateAsyncand returnAuthenticateResult.Fail("[reason]")when some part of validation fails.The token has
Audclaim 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 inHandleChallengeAsyncHandleAuthenticateAsync? 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 toHandleChallengeAsyncwhich is also not correct since authentication was successful, it's the authorization that's failedBeta Was this translation helpful? Give feedback.
All reactions