Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(refactor): tiny oidc client refactor #716

Merged
merged 1 commit into from
Oct 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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