Add proper and tested OIDC support on the server
Note that this will still not work on the client side; the followup CL for the client side is right after this one.
This commit is contained in:
parent
19f7acf575
commit
fda203e4d7
15 changed files with 756 additions and 180 deletions
|
@ -51,7 +51,7 @@ class OAuthService(object):
|
|||
def get_redirect_uri(self, app_config, redirect_suffix=''):
|
||||
return '%s://%s/oauth2/%s/callback%s' % (app_config['PREFERRED_URL_SCHEME'],
|
||||
app_config['SERVER_HOSTNAME'],
|
||||
self.service_name().lower(),
|
||||
self.service_id(),
|
||||
redirect_suffix)
|
||||
|
||||
def get_user_info(self, http_client, token):
|
||||
|
@ -74,8 +74,8 @@ class OAuthService(object):
|
|||
def exchange_code_for_token(self, app_config, http_client, code, form_encode=False,
|
||||
redirect_suffix='', client_auth=False):
|
||||
""" Exchanges an OAuth access code for the associated OAuth token. """
|
||||
json_data = self._exchange_code(app_config, http_client, code, form_encode, redirect_suffix,
|
||||
client_auth)
|
||||
json_data = self.exchange_code(app_config, http_client, code, form_encode, redirect_suffix,
|
||||
client_auth)
|
||||
|
||||
access_token = json_data.get('access_token', None)
|
||||
if access_token is None:
|
||||
|
@ -84,8 +84,9 @@ class OAuthService(object):
|
|||
|
||||
return access_token
|
||||
|
||||
def _exchange_code(self, app_config, http_client, code, form_encode=False, redirect_suffix='',
|
||||
client_auth=False):
|
||||
def exchange_code(self, app_config, http_client, code, form_encode=False, redirect_suffix='',
|
||||
client_auth=False):
|
||||
""" Exchanges an OAuth access code for associated OAuth token and other data. """
|
||||
payload = {
|
||||
'code': code,
|
||||
'grant_type': 'authorization_code',
|
||||
|
|
Reference in a new issue