Updated the OAuth service providers to properly respect the new OAuth auto-configuration settings for each provider. (#1527)

This commit is contained in:
Matt Scott 2023-04-13 13:40:25 -04:00 committed by GitHub
commit 84f84f2809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 4 deletions

View File

@ -24,9 +24,10 @@ def azure_oauth():
'fetch_token': fetch_azure_token,
}
auto_configure = Setting().get('azure_oauth_auto_configure')
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
else:
authlib_params['access_token_url'] = Setting().get('azure_oauth_token_url')

View File

@ -26,9 +26,10 @@ def github_oauth():
'update_token': update_token
}
auto_configure = Setting().get('github_oauth_auto_configure')
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
else:
authlib_params['access_token_url'] = Setting().get('github_oauth_token_url')

View File

@ -25,9 +25,10 @@ def google_oauth():
'update_token': update_token
}
auto_configure = Setting().get('google_oauth_auto_configure')
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
else:
authlib_params['access_token_url'] = Setting().get('google_token_url')

View File

@ -25,9 +25,10 @@ def oidc_oauth():
'update_token': update_token
}
auto_configure = Setting().get('oidc_oauth_auto_configure')
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
else:
authlib_params['access_token_url'] = Setting().get('oidc_oauth_token_url')