mirror of https://github.com/zulip/zulip.git
OIDC auth: when config is not correct, log the reason
This commit is contained in:
parent
09de447dd9
commit
caefc28d2d
|
@ -3117,13 +3117,18 @@ class GenericOpenIdConnectBackend(SocialAuthMixin, OpenIdConnectAuth):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def check_config(cls) -> bool:
|
def check_config(cls) -> bool:
|
||||||
|
logger = logging.getLogger(f"zulip.auth.{cls.name}")
|
||||||
if len(settings.SOCIAL_AUTH_OIDC_ENABLED_IDPS.keys()) != 1:
|
if len(settings.SOCIAL_AUTH_OIDC_ENABLED_IDPS.keys()) != 1:
|
||||||
# Only one IdP supported for now.
|
logger.error("Only one OIDC IdP supported for now")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
mandatory_config_keys = ["oidc_url", "client_id", "secret"]
|
mandatory_config_keys = ["oidc_url", "client_id", "secret"]
|
||||||
[idp_config_dict] = settings.SOCIAL_AUTH_OIDC_ENABLED_IDPS.values()
|
[idp_config_dict] = settings.SOCIAL_AUTH_OIDC_ENABLED_IDPS.values()
|
||||||
if not all(idp_config_dict.get(key) for key in mandatory_config_keys):
|
if not all(idp_config_dict.get(key) for key in mandatory_config_keys):
|
||||||
|
logger.error(
|
||||||
|
"OIDC config missing required key(s) %r",
|
||||||
|
[k for k in mandatory_config_keys if not idp_config_dict.get(k)],
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue