From a0984e365a7c610e9cb91cf73e5d09db2be6df6a Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Thu, 15 Oct 2020 12:34:35 -0700 Subject: [VVP] VVP onap-client enhancements Adding capability for custom auth plugin (defaults to basic auth). During updates to VNF models, resource and policy objects are deletd and recreated. Issue-ID: VVP-477 Signed-off-by: stark, steven Change-Id: Iba743176167c2b1df185666b08cbd79c6a559c9e --- onap-client/onap_client/aai/client.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'onap-client/onap_client/aai/client.py') diff --git a/onap-client/onap_client/aai/client.py b/onap-client/onap_client/aai/client.py index c4ab03b..2f48e62 100644 --- a/onap-client/onap_client/aai/client.py +++ b/onap-client/onap_client/aai/client.py @@ -37,7 +37,9 @@ import uuid from functools import partial +from frozendict import frozendict from onap_client.client.clients import Client +from onap_client.auth import auth_handler class AAIClient(Client): @@ -63,6 +65,24 @@ class AAIClient(Client): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, } + + @property + def aai_username(self): + """Username to authenticate to AAI""" + return self.config.aai.AAI_USERNAME + + @property + def aai_password(self): + """Password to authenticate to AAI""" + return self.config.aai.AAI_PASSWORD + + @property + def auth(self): + return auth_handler( + frozendict(self.config.aai.AUTH_PLUGIN) if self.config.aai.AUTH_PLUGIN else None, + self.aai_username, + self.aai_password, + ) -- cgit 1.2.3-korg