Skip to content

Commit

Permalink
Merge pull request #308 from mikkel14/dependent-token-enhancement
Browse files Browse the repository at this point in the history
Dependent token enhancement
  • Loading branch information
sirosen committed Aug 28, 2018
2 parents d761ba9 + 310a036 commit 08d3838
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion globus_sdk/auth/client_types/base.py
Expand Up @@ -360,7 +360,7 @@ def oauth2_token(self, form_data, response_class=OAuthTokenResponse):
**Parameters**
``response_type``
``response_class``
Defaults to :class:`OAuthTokenResponse \
<globus_sdk.auth.token_response.OAuthTokenResponse>`. This is
used by calls to the oauth2_token endpoint which need to
Expand Down
17 changes: 13 additions & 4 deletions globus_sdk/auth/client_types/confidential_client.py
Expand Up @@ -139,7 +139,7 @@ def oauth2_start_flow(
state=state, refresh_tokens=refresh_tokens)
return self.current_oauth2_flow_manager

def oauth2_get_dependent_tokens(self, token):
def oauth2_get_dependent_tokens(self, token, additional_params=None):
"""
Does a `Dependent Token Grant
<https://docs.globus.org/api/auth/reference/#dependent_token_grant_post_v2_oauth2_token>`_
Expand All @@ -166,14 +166,23 @@ def oauth2_get_dependent_tokens(self, token):
``token`` (*string*)
An Access Token as a raw string, being exchanged.
``additional_params`` (*dict*)
A ``dict`` or ``None``, which specifies additional parameters
to include in the request body
:rtype: :class:`OAuthTokenResponse
<globus_sdk.auth.token_response.OAuthTokenResponse>`
"""
self.logger.info('Getting dependent tokens from access token')
return self.oauth2_token({
self.logger.debug('additional_params={}'.format(additional_params))
form_data = {
'grant_type': 'urn:globus:auth:grant_type:dependent_token',
'token': token},
response_class=OAuthDependentTokenResponse)
'token': token}
if additional_params:
form_data.update(additional_params)

return self.oauth2_token(
form_data, response_class=OAuthDependentTokenResponse)

def oauth2_token_introspect(self, token, include=None):
"""
Expand Down

0 comments on commit 08d3838

Please sign in to comment.