Formatting changes.
This commit is contained in:
parent
7a580e6036
commit
0097daebc2
3 changed files with 10 additions and 2 deletions
|
@ -192,10 +192,12 @@ class DatabaseAuthorizationProvider(AuthorizationProvider):
|
|||
|
||||
return self._make_response(headers={'Location': url}, status_code=302)
|
||||
|
||||
|
||||
def create_application(org, name, application_uri, redirect_uri, **kwargs):
|
||||
return OAuthApplication.create(organization=org, name=name, application_uri=application_uri,
|
||||
redirect_uri=redirect_uri, **kwargs)
|
||||
|
||||
|
||||
def validate_access_token(access_token):
|
||||
try:
|
||||
found = (OAuthAccessToken
|
||||
|
@ -207,17 +209,20 @@ def validate_access_token(access_token):
|
|||
except OAuthAccessToken.DoesNotExist:
|
||||
return None
|
||||
|
||||
|
||||
def get_application_for_client_id(client_id):
|
||||
try:
|
||||
return OAuthApplication.get(client_id=client_id)
|
||||
except OAuthApplication.DoesNotExist:
|
||||
return None
|
||||
|
||||
|
||||
def reset_client_secret(application):
|
||||
application.client_secret = random_string_generator(length=40)()
|
||||
application.save()
|
||||
return application
|
||||
|
||||
|
||||
def lookup_application(org, client_id):
|
||||
try:
|
||||
return OAuthApplication.get(organization = org, client_id=client_id)
|
||||
|
|
|
@ -169,6 +169,7 @@ def swagger_route_data(include_internal=False, compact=False):
|
|||
|
||||
return swagger_data
|
||||
|
||||
|
||||
@resource('/v1/discovery')
|
||||
class DiscoveryResource(ApiResource):
|
||||
"""Ability to inspect the API for usage information and documentation."""
|
||||
|
|
|
@ -424,7 +424,8 @@ class UserAuthorization(ApiResource):
|
|||
@require_user_admin
|
||||
@nickname('getUserAuthorization')
|
||||
def get(self, access_token_uuid):
|
||||
access_token = model.oauth.lookup_access_token_for_user(get_authenticated_user(), access_token_uuid)
|
||||
access_token = model.oauth.lookup_access_token_for_user(get_authenticated_user(),
|
||||
access_token_uuid)
|
||||
if not access_token:
|
||||
raise NotFound()
|
||||
|
||||
|
@ -433,7 +434,8 @@ class UserAuthorization(ApiResource):
|
|||
@require_user_admin
|
||||
@nickname('deleteUserAuthorization')
|
||||
def delete(self, access_token_uuid):
|
||||
access_token = model.oauth.lookup_access_token_for_user(get_authenticated_user(), access_token_uuid)
|
||||
access_token = model.oauth.lookup_access_token_for_user(get_authenticated_user(),
|
||||
access_token_uuid)
|
||||
if not access_token:
|
||||
raise NotFound()
|
||||
|
||||
|
|
Reference in a new issue