default use global conf

This commit is contained in:
Kay0u 2020-01-02 12:59:16 +08:00
parent 0be1d74e4a
commit 3abde9c008
No known key found for this signature in database
GPG key ID: 7FF262C033518333
3 changed files with 20 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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