diff options
author | Piotr Borelowski <p.borelowski@partner.samsung.com> | 2020-02-11 10:00:02 +0100 |
---|---|---|
committer | Piotr Borelowski <p.borelowski@partner.samsung.com> | 2020-02-13 15:29:31 +0000 |
commit | 361511c01e4e51dddb6e3bfe11b6728a76dbbfd0 (patch) | |
tree | a6fade70552eece7d8a6df74a104cc8108044cdb /adapters/mso-ve-vnfm-adapter/src/main/java/org | |
parent | e4f76347e6eac071e5a3ff4666763b68b9075183 (diff) |
Fixed, simplified and tested AuthorizationHeadersProvider
(+small changes in poms)
Ve-Vnfm (SOL002) Adapter project
Issue-ID: SO-2574
Signed-off-by: Piotr Borelowski <p.borelowski@partner.samsung.com>
Change-Id: I480ac1d5b46aae5a9d4db8249d98c186b59fd12f
Diffstat (limited to 'adapters/mso-ve-vnfm-adapter/src/main/java/org')
2 files changed, 4 insertions, 18 deletions
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java index eca5240cb5..251e0c426b 100644 --- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java +++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java @@ -20,29 +20,15 @@ package org.onap.so.adapters.vevnfm.provider; -import java.util.List; -import org.apache.logging.log4j.util.Strings; import org.onap.so.configuration.rest.BasicHttpHeadersProvider; -import org.springframework.http.HttpHeaders; public class AuthorizationHeadersProvider extends BasicHttpHeadersProvider { - private List<String> previousAuthorization; - public void addAuthorization(final String authorization) { - final HttpHeaders headers = getHttpHeaders(); - previousAuthorization = headers.get(AUTHORIZATION_HEADER); - headers.set(AUTHORIZATION_HEADER, authorization); - } - - public void resetPrevious() { - if (!isPreviousAuthorizationBlank()) { - getHttpHeaders().addAll(AUTHORIZATION_HEADER, previousAuthorization); - } + getHttpHeaders().set(AUTHORIZATION_HEADER, authorization); } - private boolean isPreviousAuthorizationBlank() { - return previousAuthorization == null || previousAuthorization.isEmpty() - || Strings.isBlank(previousAuthorization.get(0)); + public void removeAuthorization() { + getHttpHeaders().remove(AUTHORIZATION_HEADER); } } diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java index 0e77ce4073..eefd9ba93b 100644 --- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java +++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java @@ -68,7 +68,7 @@ public class SubscriberService { final LccnSubscriptionRequest request = createRequest(); return sender.send(info, request); } finally { - headersProvider.resetPrevious(); + headersProvider.removeAuthorization(); } } |