From aeed885d986f57c7fb01a69322340bf86130915d Mon Sep 17 00:00:00 2001 From: vpsx <19900057+vpsx@users.noreply.github.com> Date: Mon, 21 Oct 2019 17:57:49 -0500 Subject: [PATCH] chore(refactor): tiny oidc client refactor (#716) --- fence/__init__.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/fence/__init__.py b/fence/__init__.py index 43e93738e..fa3354a62 100644 --- a/fence/__init__.py +++ b/fence/__init__.py @@ -258,10 +258,7 @@ 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"), @@ -269,10 +266,7 @@ def _setup_oidc_clients(app): ) # 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"), @@ -286,10 +280,7 @@ 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"), @@ -297,11 +288,7 @@ def _setup_oidc_clients(app): ) # 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"])