-
-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework security flow #686
Rework security flow #686
Conversation
b4a794c
to
6258264
Compare
connexion/decorators/security.py
Outdated
if not scope_validate_func(required_scopes, token_scopes): | ||
raise OAuthScopeProblem( | ||
description='Provided token doesn\'t have the required scope', | ||
required_scopes=oauth_args[2], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think oauth_args
is in scope here.
I think you want required_scopes
0b49ed2
to
f76dcc3
Compare
Backward incompatible change! Instead of connexion.request.user / flask.request.user, use connexion.context['user']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Can you also include some examples of possible customizations in the documentation?
Do you have any objectives on breaking changes? I'm currently thinking about creating the verify_* callbacks on api level (instead of creating them for each operation). They only depend on the security_scheme, scope is passed later at call-time. That would also fix auth_all_paths for openapi 3, which currently uses AbstractAPI.security_definitions, which is only set for swagger 2. |
We don't have a hard policy about breaking changes, but 2.0 already includes big backward incompatible changes, and any new breaking change will make it harder for people to migrate.
I would keep it with a DeprecationWarning to minimize disruption, and then we can remove it at a later time (what do you thing @hjacobs). |
Updated documentation and examples. |
14ff115
to
3257f56
Compare
👍 |
Do you want me to squash again and also add a note about the change in flask.request? |
@cziebuhr That would be perfect. |
Done and updated readme. |
👍 |
The PR addresses some issues I had when trying to use connexion for a production-ready product.
In our setup, we want to add more logic, e.g. scope 'ressource' is superior to 'ressource:read'. One can now set a custom scope validator.
It's not yet fully tested and documentation/examples are not updated yet, but I would like to get some general feedback on that approach.