Cleaned unused stuff or overly complicated for no reason

This commit is contained in:
Alexandre Aubin 2019-08-20 03:31:07 +02:00
parent 83d9e772e7
commit 8d77fdb9a4
3 changed files with 1 additions and 35 deletions

View file

@ -1,6 +1,5 @@
{
"argument_required": "Argument '{argument}' is required",
"authentication_profile_required": "Authentication to profile '{profile}' required",
"authentication_required": "Authentication required",
"authentication_required_long": "Authentication is required to perform this action",
"colon": "{}: ",

View file

@ -159,9 +159,6 @@ class BaseActionsMapParser(object):
auth = msignals.authenticate(cls(), **auth_conf)
if not auth.is_authenticated:
raise MoulinetteError('authentication_required_long')
if self.get_conf(tid, 'argument_auth') and \
self.get_conf(tid, 'authenticate') == 'all':
namespace.auth = auth
return namespace
@ -302,32 +299,6 @@ class BaseActionsMapParser(object):
"for configuration 'authenticator', got %r", auth)
raise MoulinetteError('error_see_log')
# -- 'argument_auth'
try:
arg_auth = configuration['argument_auth']
except KeyError:
pass
else:
if isinstance(arg_auth, bool):
conf['argument_auth'] = arg_auth
else:
logger.error("expecting a boolean for configuration "
"'argument_auth', got %r", arg_auth)
raise MoulinetteError('error_see_log')
# -- 'lock'
try:
lock = configuration['lock']
except KeyError:
pass
else:
if isinstance(lock, bool):
conf['lock'] = lock
else:
logger.error("expecting a boolean for configuration 'lock', "
"got %r", lock)
raise MoulinetteError('error_see_log')
return conf
def _format_conf(self, name, value):

View file

@ -473,11 +473,7 @@ class _ActionsMapPlugin(object):
s_hash = request.get_cookie('session.hashes',
secret=s_secret, default={})[authenticator.name]
except KeyError:
if authenticator.name == 'default':
msg = m18n.g('authentication_required')
else:
msg = m18n.g('authentication_profile_required',
profile=authenticator.name)
msg = m18n.g('authentication_required')
raise HTTPUnauthorizedResponse(msg)
else:
return authenticator(token=(s_id, s_hash))