split authcode into verification/response (rebase on remove user feature)#120
Conversation
There was a problem hiding this comment.
Overall, the solution looks interesting, but I’m a bit concerned that validate_authorization_request can now return two different objects: Response (in case of an error) or AuthorizationState (if validation is successful). This makes the library's API less explicit. Let me experiment with this code a bit more.
Please do :) It's definitely not ideal but I wasn't sure how to avoid it with aioauth's preference of turning errors into response objects automatically. I didn't want to break the standard of how all the other calls work to handle it any other way. I don't dislike that aioauth does this either, in fact I think its probably a good thing that it pre-packages the response since as you know there are certain http header requirements in order to follow the rfc. That and it makes handling simpler in most cases. |
|
I should note for the record that, whilst the removal Validating the request twice in a single call using the standard That being said, I'm not totally against the changes I propose here either. I just don't want this new PR to feel like a push from me to get these changes made, its only really a proposal of possibility. |
I understand, that's why I started v2, so it would be easier for us to discuss new changes. I'm very grateful for your ideas. Actually, I really like the idea with a separate state and I would like to use it. Give me more time to think about this and find more options. We seem to be very close to a compromise solution. |
Re implementation of #102 with rebase from #118.
I think the removal of the user-check simplifies some of the issues I originally encountered with implementing the separation of authorization-code validation/request since now the developer can assume the response will always be an error that does not need to be specially handled if
validate_authorization_requestreturns anything other than anAuthorizationStateobject.The code is relatively clean and allows for more direct and clear branches to handle each possibility when processing the authorization request:
Old Version (before PR):
New Version (after PR):