From 3abde9c00819766fd8d1b896d0fdc4b9e794aacb Mon Sep 17 00:00:00 2001 From: Kay0u Date: Thu, 2 Jan 2020 12:59:16 +0800 Subject: [PATCH] default use global conf --- moulinette/interfaces/api.py | 11 ++++++++++- moulinette/interfaces/cli.py | 11 ++++++++++- test/actionsmap/moulitest.yml | 6 ------ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/moulinette/interfaces/api.py b/moulinette/interfaces/api.py index c6a12bcf..7ecf90eb 100644 --- a/moulinette/interfaces/api.py +++ b/moulinette/interfaces/api.py @@ -666,7 +666,16 @@ class ActionsMapParser(BaseActionsMapParser): raise MoulinetteError("error_see_log") if self.get_conf(tid, "authenticate"): - return self.get_conf(tid, "authenticator") + authenticator = self.get_conf(tid, "authenticator") + + # If several authenticator, use the default one + if isinstance(authenticator, dict): + if 'default' in authenticator: + authenticator = 'default' + else: + # TODO which one should we use? + pass + return authenticator else: return False diff --git a/moulinette/interfaces/cli.py b/moulinette/interfaces/cli.py index 1d5b89ae..22aa9799 100644 --- a/moulinette/interfaces/cli.py +++ b/moulinette/interfaces/cli.py @@ -379,7 +379,16 @@ class ActionsMapParser(BaseActionsMapParser): tid = getattr(ret, "_tid", None) if self.get_conf(tid, "authenticate"): - return self.get_conf(tid, "authenticator") + authenticator = self.get_conf(tid, "authenticator") + + # If several authenticator, use the default one + if isinstance(authenticator, dict): + if 'default' in authenticator: + authenticator = 'default' + else: + # TODO which one should we use? + pass + return authenticator else: return False diff --git a/test/actionsmap/moulitest.yml b/test/actionsmap/moulitest.yml index 93833f1d..b44e0ff2 100644 --- a/test/actionsmap/moulitest.yml +++ b/test/actionsmap/moulitest.yml @@ -34,9 +34,6 @@ testauth: default: api: GET /test-auth/default - configuration: - authenticate: all - authenticator: default only-api: api: GET /test-auth/only-api @@ -67,9 +64,6 @@ testauth: default: api: GET /test-auth/subcat/default - configuration: - authenticate: all - authenticator: default post: api: POST /test-auth/subcat/post