Skip to content

Commit

Permalink
chore(refactor): tiny oidc client refactor (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpsx authored Oct 21, 2019
1 parent 4d12f0c commit aeed885
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions fence/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,15 @@ def _setup_oidc_clients(app):
oidc = config.get("OPENID_CONNECT", {})

# Add OIDC client for Google if configured.
configured_google = (
"OPENID_CONNECT" in config and "google" in config["OPENID_CONNECT"]
)
if configured_google:
if "google" in oidc:
app.google_client = GoogleClient(
config["OPENID_CONNECT"]["google"],
HTTP_PROXY=config.get("HTTP_PROXY"),
logger=logger,
)

# Add OIDC client for ORCID if configured.
configured_orcid = (
"OPENID_CONNECT" in config and "orcid" in config["OPENID_CONNECT"]
)
if configured_orcid:
if "orcid" in oidc:
app.orcid_client = ORCIDClient(
config["OPENID_CONNECT"]["orcid"],
HTTP_PROXY=config.get("HTTP_PROXY"),
Expand All @@ -286,22 +280,15 @@ def _setup_oidc_clients(app):
)

# Add OIDC client for Microsoft if configured.
configured_microsoft = (
"OPENID_CONNECT" in config and "microsoft" in config["OPENID_CONNECT"]
)
if configured_microsoft:
if "microsoft" in oidc:
app.microsoft_client = MicrosoftClient(
config["OPENID_CONNECT"]["microsoft"],
HTTP_PROXY=config.get("HTTP_PROXY"),
logger=logger,
)

# Add OIDC client for multi-tenant fence if configured.
configured_fence = (
"OPENID_CONNECT" in config
and "fence" in config["OPENID_CONNECT"]
and "fence" in enabled_idp_ids
)
configured_fence = "fence" in oidc and "fence" in enabled_idp_ids
if configured_fence:
app.fence_client = OAuthClient(**config["OPENID_CONNECT"]["fence"])

Expand Down

0 comments on commit aeed885

Please sign in to comment.