diff --git a/docs/en_US/oauth2.rst b/docs/en_US/oauth2.rst index 9579fdc3c..ca03905c7 100644 --- a/docs/en_US/oauth2.rst +++ b/docs/en_US/oauth2.rst @@ -28,6 +28,7 @@ and modify the values for the following parameters: "OAUTH2_CLIENT_SECRET", "Oauth2 Client Secret" "OAUTH2_TOKEN_URL", "Oauth2 Access Token endpoint" "OAUTH2_AUTHORIZATION_URL", "Endpoint for user authorization" + "OAUTH2_SERVER_METADATA_URL", "Server metadata url for your OAuth2 provider" "OAUTH2_API_BASE_URL", "Oauth2 base URL endpoint to make requests simple, ex: *https://api.github.com/*" "OAUTH2_USERINFO_ENDPOINT", "User Endpoint, ex: *user* (for github) and *useinfo* (for google)" "OAUTH2_SCOPE", "Oauth scope, ex: 'openid email profile'. Note that an 'email' claim is required in the resulting profile." diff --git a/web/config.py b/web/config.py index d04069d02..e9f1b5db5 100644 --- a/web/config.py +++ b/web/config.py @@ -747,6 +747,8 @@ OAUTH2_CONFIG = [ # URL is used for authentication, # Ex: https://github.com/login/oauth/authorize 'OAUTH2_AUTHORIZATION_URL': None, + # server metadata url might optional for your provider + 'OAUTH2_SERVER_METADATA_URL': None, # Oauth base url, ex: https://api.github.com/ 'OAUTH2_API_BASE_URL': None, # Name of the Endpoint, ex: user diff --git a/web/pgadmin/authenticate/oauth2.py b/web/pgadmin/authenticate/oauth2.py index dbfeacc0a..f8f4570d2 100644 --- a/web/pgadmin/authenticate/oauth2.py +++ b/web/pgadmin/authenticate/oauth2.py @@ -106,6 +106,8 @@ class OAuth2Authentication(BaseAuthentication): api_base_url=oauth2_config['OAUTH2_API_BASE_URL'], client_kwargs={'scope': oauth2_config.get( 'OAUTH2_SCOPE', 'email profile')}, + server_metadata_url=oauth2_config.get( + 'OAUTH2_SERVER_METADATA_URL', None) ) def get_source_name(self):