use default authenticator if none is defined

This commit is contained in:
Kay0u 2020-01-02 12:17:12 +08:00
parent 6f7f870d3d
commit ac4a4c34b1
No known key found for this signature in database
GPG key ID: 7FF262C033518333

View file

@ -256,22 +256,21 @@ class BaseActionsMapParser(object):
raise MoulinetteError("error_see_log")
# -- 'authenticator'
try:
if "authenticator" in configuration:
auth = configuration["authenticator"]
except KeyError:
pass
else:
auth = 'default'
if not is_global and isinstance(auth, str):
try:
# Store needed authenticator profile
conf["authenticator"] = self.global_conf["authenticator"][auth]
except KeyError:
if auth not in self.global_conf["authenticator"]:
logger.error(
"requesting profile '%s' which is undefined in "
"global configuration of 'authenticator'",
auth,
)
raise MoulinetteError("error_see_log")
else:
conf["authenticator"] = auth
elif is_global and isinstance(auth, dict):
if len(auth) == 0:
logger.warning(