From 9218d80e65bf3eaa01e7942730bac8c72dcb7862 Mon Sep 17 00:00:00 2001 From: Rob Daugherty Date: Wed, 18 Apr 2018 16:57:11 -0400 Subject: AAIRestClient support for Basic Auth Adding support for Basic Auth in the AAI Rest Clients because ONAP uses this (whereas ECOMP uses 2-way SSL). In general, each AAI client will allow the user to configure properties called "aai.auth" and "mso.msoKey". If these are set, then the client will add the Authorization header to every request. Change-Id: I7c81ec05d2ec4a7dca131f2e9e19d341ac89b09f Issue-ID: SO-576 Signed-off-by: Rob Daugherty --- .../openecomp/mso/client/aai/AAIResourcesClientTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'common/src/test/java') diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java index daf8130cd4..c7cc549130 100644 --- a/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java +++ b/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java @@ -77,6 +77,21 @@ public class AAIResourcesClientTest { client.delete(path); } + @Test + public void verifyBasicAuth() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); + wireMockRule.stubFor(get( + urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString())) + .withHeader("Authorization", equalTo("Basic TVNPOk1TTw==")) + .willReturn( + aResponse() + .withHeader("Content-Type", "application/json") + .withBodyFile("aai/resources/mockObject.json") + .withStatus(200))); + AAIResourcesClient client = new AAIResourcesClient(); + client.get(path); + } + @Test public void verifyConnect() { AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); -- cgit 1.2.3-korg