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)
|
return self._make_response(headers={'Location': url}, status_code=302)
|
||||||
|
|
||||||
|
|
||||||
def create_application(org, name, application_uri, redirect_uri, **kwargs):
|
def create_application(org, name, application_uri, redirect_uri, **kwargs):
|
||||||
return OAuthApplication.create(organization=org, name=name, application_uri=application_uri,
|
return OAuthApplication.create(organization=org, name=name, application_uri=application_uri,
|
||||||
redirect_uri=redirect_uri, **kwargs)
|
redirect_uri=redirect_uri, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def validate_access_token(access_token):
|
def validate_access_token(access_token):
|
||||||
try:
|
try:
|
||||||
found = (OAuthAccessToken
|
found = (OAuthAccessToken
|
||||||
|
@ -207,17 +209,20 @@ def validate_access_token(access_token):
|
||||||
except OAuthAccessToken.DoesNotExist:
|
except OAuthAccessToken.DoesNotExist:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_application_for_client_id(client_id):
|
def get_application_for_client_id(client_id):
|
||||||
try:
|
try:
|
||||||
return OAuthApplication.get(client_id=client_id)
|
return OAuthApplication.get(client_id=client_id)
|
||||||
except OAuthApplication.DoesNotExist:
|
except OAuthApplication.DoesNotExist:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def reset_client_secret(application):
|
def reset_client_secret(application):
|
||||||
application.client_secret = random_string_generator(length=40)()
|
application.client_secret = random_string_generator(length=40)()
|
||||||
application.save()
|
application.save()
|
||||||
return application
|
return application
|
||||||
|
|
||||||
|
|
||||||
def lookup_application(org, client_id):
|
def lookup_application(org, client_id):
|
||||||
try:
|
try:
|
||||||
return OAuthApplication.get(organization = org, client_id=client_id)
|
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
|
return swagger_data
|
||||||
|
|
||||||
|
|
||||||
@resource('/v1/discovery')
|
@resource('/v1/discovery')
|
||||||
class DiscoveryResource(ApiResource):
|
class DiscoveryResource(ApiResource):
|
||||||
"""Ability to inspect the API for usage information and documentation."""
|
"""Ability to inspect the API for usage information and documentation."""
|
||||||
|
|
|
@ -424,7 +424,8 @@ class UserAuthorization(ApiResource):
|
||||||
@require_user_admin
|
@require_user_admin
|
||||||
@nickname('getUserAuthorization')
|
@nickname('getUserAuthorization')
|
||||||
def get(self, access_token_uuid):
|
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:
|
if not access_token:
|
||||||
raise NotFound()
|
raise NotFound()
|
||||||
|
|
||||||
|
@ -433,7 +434,8 @@ class UserAuthorization(ApiResource):
|
||||||
@require_user_admin
|
@require_user_admin
|
||||||
@nickname('deleteUserAuthorization')
|
@nickname('deleteUserAuthorization')
|
||||||
def delete(self, access_token_uuid):
|
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:
|
if not access_token:
|
||||||
raise NotFound()
|
raise NotFound()
|
||||||
|
|
||||||
|
|
Reference in a new issue