-
Notifications
You must be signed in to change notification settings - Fork 598
[AuthN] Clean up 401-403 AuthenticateCalled #273
Comments
Summary of plan:HttpAbstractions:
AuthenticationHandler changes:
@lodejard is this what you had in mind? |
Kewl, another totally insane design for 403 handling 😄 I'll probably repeat myself, but authentication middleware are NOT the right place for that. The weirdest thing with this new approach is that you (= the ASP.NET team) don't seem to realize that it is semantically aberrant: a "challenge" operation (or whatever you call it) cannot result in a 403 response (like your snippets suggest): a challenge is ALWAYS the consequence of a 401 response: http://tools.ietf.org/html/rfc2617
Interesting. What's the reason behind these changes? |
@HaoK FYI, I'm prototyping a new authorization middleware that reuses the (excellent) CORS approach and offers a far better way (at least, IMO) to handle authorization and set the appropriate response status code: https://github.com/PinpointTownes/Security/commit/7ac1a2515015a98dc6f4919f28baa9db33beb50a#diff-7bf20fd130932f29f2028b7126281f84R58 (it doesn't build as I haven't updated the tests but you should get the idea) |
Currently for 401-403 to work, the AuthenticateCalled flag must be set. This is a pretty obscure thing for subclasses to be required to do and is very easy to miss. Cookie was missing this and as a result broke 401-403. We should revisit this and see if there's anyway to make this more seamless...
@blowdart
The text was updated successfully, but these errors were encountered: