Skip to content

Commit

Permalink
working implementation of callback_url format check
Browse files Browse the repository at this point in the history
  • Loading branch information
feyruzb committed Jan 9, 2025
1 parent 1df88ff commit bbd0a80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion web/server/codechecker_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,8 @@ def check_callback_url_format(provider_name, callback_url):
# the 2 varible are here because in 1 line it was too long
auth_config = cfg_dict['authentication']['method_oauth']
oauth_config = auth_config.get('providers', {})
# Iterate through the providers and print the callback_url
# Iterate through the providers and
# checks the format of callback url
for provider_name, provider_data in oauth_config.items():
callback_url = provider_data.get('oauth_callback_url')
try:
Expand All @@ -1085,6 +1086,7 @@ def check_callback_url_format(provider_name, callback_url):
LOG.error("The callback url format is invalid. "
"Please check the configuration file.")
# turns off the provider if the callback url is invalid
LOG.debug("Turning off the provider: %s", provider_name)
provider_data['enabled'] = False
except IOError as ioerr:
LOG.debug(ioerr)
Expand Down
6 changes: 3 additions & 3 deletions web/server/config/server_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"oauth_client_id" : "ExampleClientID",
"oauth_client_secret": "ExampleClientSecret",
"oauth_authorization_uri": "https://github.com/login/oauth/authorize",
"oauth_callback_url": "http://path_To_CodeChecker_Login_Page/provider",
"oauth_callback_url": "http://codechecker_host/login/OAuthLogin/provider",
"oauth_token_uri": "https://github.com/login/oauth/access_token",
"oauth_user_info_uri": "https://api.github.com/user",
"oauth_scope": "openid email profile",
Expand All @@ -83,7 +83,7 @@
"oauth_client_id" : "ExampleClientID",
"oauth_client_secret" : "ExampleClientSecret",
"oauth_authorization_uri" : "https://accounts.google.com/o/oauth2/auth",
"oauth_callback_url" : "http://path_To_CodeChecker_Login_Page/provider",
"oauth_callback_url" : "http://codechecker_host/login/OAuthLogin/provider",
"oauth_token_uri" : "https://accounts.google.com/o/oauth2/token",
"oauth_user_info_uri" : "https://www.googleapis.com/oauth2/v1/userinfo",
"oauth_scope" : "openid email profile",
Expand All @@ -101,7 +101,7 @@
"oauth_client_id": "ExampleClientID",
"oauth_client_secret": "ExampleClientSecret",
"oauth_authorization_uri": "https://login.microsoftonline.com/92e84ceb-fbfd-47ab-be52-080c6b87953f/oauth2/v2.0/authorize",
"oauth_callback_url": "http://path_To_CodeChecker_Login_Page/provider",
"oauth_callback_url": "http://codechecker_host/login/OAuthLogin/provider",
"oauth_token_uri": "https://login.microsoftonline.com/92e84ceb-fbfd-47ab-be52-080c6b87953f/oauth2/v2.0/token",
"oauth_user_info_uri": "https://graph.microsoft.com/v1.0/me",
"oauth_scope": "User.Read email profile openid",
Expand Down

0 comments on commit bbd0a80

Please sign in to comment.