User scope objects everywhere. Switch scope objects to namedtuples. Pass the user when validating whether the user has authorized such scopes in the past. Make sure we calculate the scope string using all user scopes form all previously granted tokens.
This commit is contained in:
parent
c93c62600d
commit
3b7b12085d
6 changed files with 103 additions and 76 deletions
|
@ -100,7 +100,11 @@ def swagger_route_data(include_internal=False, compact=False):
|
|||
scope = method_metadata(method, 'oauth2_scope')
|
||||
if scope and not compact:
|
||||
new_operation['authorizations'] = {
|
||||
'oauth2': [scope],
|
||||
'oauth2': [
|
||||
{
|
||||
'scope': scope.scope
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
internal = method_metadata(method, 'internal')
|
||||
|
@ -148,7 +152,7 @@ def swagger_route_data(include_internal=False, compact=False):
|
|||
},
|
||||
'authorizations': {
|
||||
'oauth2': {
|
||||
'scopes': list(scopes.ALL_SCOPES.values()),
|
||||
'scopes': [scope._asdict() for scope in scopes.ALL_SCOPES.values()],
|
||||
'grantTypes': {
|
||||
"implicit": {
|
||||
"tokenName": "access_token",
|
||||
|
|
Reference in a new issue