Skip to content

Commit

Permalink
frontend/oidc: clean up duplicate return code
Browse files Browse the repository at this point in the history
A small snippet of code checking the existence of a particular key is
duplicated several times in oidc_enabled().  This commit is a small
clean up to reduce some of the duplicated code.
  • Loading branch information
Bob131 authored and FrostyX committed Dec 19, 2023
1 parent 2c3e3f8 commit 22df66d
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions frontend/coprs_frontend/coprs/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,10 @@ def oidc_enabled(config):
app.logger.error("OIDC_LOGIN or OIDC_PROVIDER_NAME is empty")
return False

if not config.get("OIDC_CLIENT"):
app.logger.error("OIDC_CLIENT is empty")
return False

if not config.get("OIDC_SECRET"):
app.logger.error("OIDC_SECRET is empty")
return False

if not config.get("OIDC_SCOPES"):
app.logger.error("OIDC_SCOPES is empty")
return False
for key in ["OIDC_CLIENT", "OIDC_SECRET", "OIDC_SCOPES"]:
if not config.get(key):
app.logger.error("%s is empty", key)
return False

if not config.get("OIDC_TOKEN_AUTH_METHOD"):
app.logger.warning("OIDC_SCOPES is empty, using default method: client_secret_basic")
Expand Down

0 comments on commit 22df66d

Please sign in to comment.