Fix handling of tokens in the new context block of the JWT

This commit is contained in:
Joseph Schorr 2015-12-15 16:52:22 -05:00
parent 4a84388f15
commit 4e942203cb
2 changed files with 34 additions and 2 deletions

View file

@ -95,7 +95,11 @@ def get_granted_entity():
return GrantedEntity(user=user)
if kind == 'token':
return GrantedEntity(token=context.get('token'))
token = model.token.load_token_data(context.get('token'))
if not token:
return None
return GrantedEntity(token=token)
if kind == 'oauth':
user = model.user.get_user(context.get('user', ''))
@ -142,7 +146,7 @@ def build_context_and_subject(user, token, oauthtoken):
if token:
context = {
'kind': 'token',
'token': token,
'token': token.code,
}
return (context, None)