mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Fix issues in previous commits regarding authentication mecanism
This commit is contained in:
parent
ee1e63c7a1
commit
964483b23b
3 changed files with 13 additions and 0 deletions
|
@ -90,6 +90,11 @@ class APIQueueHandler(logging.Handler):
|
||||||
|
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
|
|
||||||
|
# Prevent triggering this function while moulinette
|
||||||
|
# is being initialized with --debug
|
||||||
|
if not self.actionsmap or len(request.cookies) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
profile = request.params.get("profile", self.actionsmap.default_authentication)
|
profile = request.params.get("profile", self.actionsmap.default_authentication)
|
||||||
authenticator = self.actionsmap.get_authenticator(profile)
|
authenticator = self.actionsmap.get_authenticator(profile)
|
||||||
|
|
||||||
|
@ -484,6 +489,8 @@ class _ActionsMapPlugin(object):
|
||||||
try:
|
try:
|
||||||
s_id = authenticator.get_session_cookie()["id"]
|
s_id = authenticator.get_session_cookie()["id"]
|
||||||
queue = self.log_queues[s_id]
|
queue = self.log_queues[s_id]
|
||||||
|
except MoulinetteAuthenticationError:
|
||||||
|
pass
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -61,6 +61,9 @@ class Authenticator(BaseAuthenticator):
|
||||||
return {"id": random_ascii()}
|
return {"id": random_ascii()}
|
||||||
raise MoulinetteAuthenticationError("unable_authenticate")
|
raise MoulinetteAuthenticationError("unable_authenticate")
|
||||||
|
|
||||||
|
if not infos and raise_if_no_session_exists:
|
||||||
|
raise MoulinetteAuthenticationError("unable_authenticate")
|
||||||
|
|
||||||
if "id" not in infos:
|
if "id" not in infos:
|
||||||
infos["id"] = random_ascii()
|
infos["id"] = random_ascii()
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,9 @@ class Authenticator(BaseAuthenticator):
|
||||||
return {"id": random_ascii()}
|
return {"id": random_ascii()}
|
||||||
raise MoulinetteAuthenticationError("unable_authenticate")
|
raise MoulinetteAuthenticationError("unable_authenticate")
|
||||||
|
|
||||||
|
if not infos and raise_if_no_session_exists:
|
||||||
|
raise MoulinetteAuthenticationError("unable_authenticate")
|
||||||
|
|
||||||
if "id" not in infos:
|
if "id" not in infos:
|
||||||
infos["id"] = random_ascii()
|
infos["id"] = random_ascii()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue