mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
use the right authenticator
This commit is contained in:
parent
ac4a4c34b1
commit
94ccd9b05c
1 changed files with 8 additions and 13 deletions
|
@ -657,24 +657,19 @@ class ActionsMapParser(BaseActionsMapParser):
|
||||||
# Return the created parser
|
# Return the created parser
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def auth_required(self, args, route, **kwargs):
|
def auth_required(self, args, **kwargs):
|
||||||
try:
|
try:
|
||||||
# Retrieve the tid for the route
|
# Retrieve the tid for the route
|
||||||
tid, _ = self._parsers[route]
|
tid, _ = self._parsers[kwargs.get("route")]
|
||||||
if not self.get_conf(tid, "authenticate"):
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
# TODO: In the future, we could make the authentication
|
|
||||||
# dependent of the route being hit ...
|
|
||||||
# e.g. in the context of friend2friend stuff that could
|
|
||||||
# auth with some custom auth system to access some
|
|
||||||
# data with something like :
|
|
||||||
# return self.get_conf(tid, 'authenticator')
|
|
||||||
return "default"
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.error("no argument parser found for route '%s'", route)
|
logger.error("no argument parser found for route '%s'", kwargs.get("route"))
|
||||||
raise MoulinetteError("error_see_log")
|
raise MoulinetteError("error_see_log")
|
||||||
|
|
||||||
|
if self.get_conf(tid, "authenticate"):
|
||||||
|
return self.get_conf(tid, "authenticator")
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def parse_args(self, args, route, **kwargs):
|
def parse_args(self, args, route, **kwargs):
|
||||||
"""Parse arguments
|
"""Parse arguments
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue