Updated the OAuth service providers to properly respect the new OAuth autoconfiguration settings for each provider.

This commit is contained in:
Matt Scott 2023-04-13 13:34:41 -04:00
parent 8108caf96a
commit d7f3610b51
No known key found for this signature in database
GPG Key ID: A9A0AFFC0E079001
4 changed files with 8 additions and 4 deletions

View File

@ -24,9 +24,10 @@ def azure_oauth():
'fetch_token': fetch_azure_token, 'fetch_token': fetch_azure_token,
} }
auto_configure = Setting().get('azure_oauth_auto_configure')
server_metadata_url = Setting().get('azure_oauth_metadata_url') server_metadata_url = Setting().get('azure_oauth_metadata_url')
if isinstance(server_metadata_url, str) and len(server_metadata_url.strip()) > 0: if auto_configure and isinstance(server_metadata_url, str) and len(server_metadata_url.strip()) > 0:
authlib_params['server_metadata_url'] = server_metadata_url authlib_params['server_metadata_url'] = server_metadata_url
else: else:
authlib_params['access_token_url'] = Setting().get('azure_oauth_token_url') authlib_params['access_token_url'] = Setting().get('azure_oauth_token_url')

View File

@ -26,9 +26,10 @@ def github_oauth():
'update_token': update_token 'update_token': update_token
} }
auto_configure = Setting().get('github_oauth_auto_configure')
server_metadata_url = Setting().get('github_oauth_metadata_url') server_metadata_url = Setting().get('github_oauth_metadata_url')
if isinstance(server_metadata_url, str) and len(server_metadata_url.strip()) > 0: if auto_configure and isinstance(server_metadata_url, str) and len(server_metadata_url.strip()) > 0:
authlib_params['server_metadata_url'] = server_metadata_url authlib_params['server_metadata_url'] = server_metadata_url
else: else:
authlib_params['access_token_url'] = Setting().get('github_oauth_token_url') authlib_params['access_token_url'] = Setting().get('github_oauth_token_url')

View File

@ -25,9 +25,10 @@ def google_oauth():
'update_token': update_token 'update_token': update_token
} }
auto_configure = Setting().get('google_oauth_auto_configure')
server_metadata_url = Setting().get('google_oauth_metadata_url') server_metadata_url = Setting().get('google_oauth_metadata_url')
if isinstance(server_metadata_url, str) and len(server_metadata_url.strip()) > 0: if auto_configure and isinstance(server_metadata_url, str) and len(server_metadata_url.strip()) > 0:
authlib_params['server_metadata_url'] = server_metadata_url authlib_params['server_metadata_url'] = server_metadata_url
else: else:
authlib_params['access_token_url'] = Setting().get('google_token_url') authlib_params['access_token_url'] = Setting().get('google_token_url')

View File

@ -25,9 +25,10 @@ def oidc_oauth():
'update_token': update_token 'update_token': update_token
} }
auto_configure = Setting().get('oidc_oauth_auto_configure')
server_metadata_url = Setting().get('oidc_oauth_metadata_url') server_metadata_url = Setting().get('oidc_oauth_metadata_url')
if isinstance(server_metadata_url, str) and len(server_metadata_url.strip()) > 0: if auto_configure and isinstance(server_metadata_url, str) and len(server_metadata_url.strip()) > 0:
authlib_params['server_metadata_url'] = server_metadata_url authlib_params['server_metadata_url'] = server_metadata_url
else: else:
authlib_params['access_token_url'] = Setting().get('oidc_oauth_token_url') authlib_params['access_token_url'] = Setting().get('oidc_oauth_token_url')