Add access_token if token in response_type param.
This commit is contained in:
parent
77d1bf86e8
commit
c5e37e9fdb
1 changed files with 13 additions and 9 deletions
|
@ -102,6 +102,7 @@ class AuthorizeEndpoint(object):
|
||||||
code.scope = self.params.scope
|
code.scope = self.params.scope
|
||||||
code.save()
|
code.save()
|
||||||
|
|
||||||
|
# Create the response uri.
|
||||||
uri = self.params.redirect_uri + '?code={0}'.format(code.code)
|
uri = self.params.redirect_uri + '?code={0}'.format(code.code)
|
||||||
|
|
||||||
else: # Implicit Flow
|
else: # Implicit Flow
|
||||||
|
@ -123,13 +124,18 @@ class AuthorizeEndpoint(object):
|
||||||
id_token = encode_id_token(
|
id_token = encode_id_token(
|
||||||
id_token_dic, self.client.client_secret)
|
id_token_dic, self.client.client_secret)
|
||||||
|
|
||||||
# TODO: Check if response_type is 'id_token token' then
|
# Create the response uri.
|
||||||
|
uri = self.params.redirect_uri + \
|
||||||
|
'#token_type={0}&id_token={1}&expires_in={2}'.format(
|
||||||
|
'bearer',
|
||||||
|
id_token,
|
||||||
|
60 * 10,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Check if response_type is 'id_token token' then
|
||||||
# add access_token to the fragment.
|
# add access_token to the fragment.
|
||||||
uri = self.params.redirect_uri + '#token_type={0}&id_token={1}&expires_in={2}'.format(
|
if self.params.response_type == 'id_token token':
|
||||||
'bearer',
|
uri += '&access_token={0}'.format(token.access_token)
|
||||||
id_token,
|
|
||||||
60 * 10
|
|
||||||
)
|
|
||||||
except:
|
except:
|
||||||
raise AuthorizeError(
|
raise AuthorizeError(
|
||||||
self.params.redirect_uri,
|
self.params.redirect_uri,
|
||||||
|
@ -137,8 +143,6 @@ class AuthorizeEndpoint(object):
|
||||||
self.grant_type)
|
self.grant_type)
|
||||||
|
|
||||||
# Add state if present.
|
# Add state if present.
|
||||||
uri = uri + \
|
uri += ('&state={0}'.format(self.params.state) if self.params.state else '')
|
||||||
('&state={0}'.format(self.params.state)
|
|
||||||
if self.params.state else '')
|
|
||||||
|
|
||||||
return uri
|
return uri
|
||||||
|
|
Loading…
Reference in a new issue