Refactor our auth handling code to be cleaner
Breaks out the validation code from the auth context modification calls, makes decorators easier to define and adds testing for each individual piece. Will be the basis of better error messaging in the following change.
This commit is contained in:
parent
1bd4422da9
commit
651666b60b
18 changed files with 830 additions and 455 deletions
|
@ -283,8 +283,9 @@ def list_applications_for_org(org):
|
|||
return query
|
||||
|
||||
|
||||
def create_access_token_for_testing(user_obj, client_id, scope, access_token='test'):
|
||||
expires_at = datetime.utcnow() + timedelta(seconds=10000)
|
||||
def create_access_token_for_testing(user_obj, client_id, scope, access_token='test',
|
||||
expires_in=10000):
|
||||
expires_at = datetime.utcnow() + timedelta(seconds=expires_in)
|
||||
application = get_application_for_client_id(client_id)
|
||||
created = OAuthAccessToken.create(application=application, authorized_user=user_obj, scope=scope,
|
||||
token_type='token', access_token=access_token,
|
||||
|
|
Reference in a new issue