diff options
author | Kotta, Shireesha (sk434m) <sk434m@att.com> | 2018-12-17 10:30:21 -0500 |
---|---|---|
committer | Kotta, Shireesha (sk434m) <shireesha.kotta@att.com> | 2018-12-17 10:56:08 -0500 |
commit | 4686d8a9ec9367e7dc75770cb69c60d5c592e63a (patch) | |
tree | c521266b9f666225393e48e112927d52b5570df9 | |
parent | 37ed86ed44e466409ac6d0ab425589377ab33c81 (diff) |
CADI Integration
Issue-ID: PORTAL-474
System to system authorization using CADI
Change-Id: I3a62840b4108851bf3f18f5c09f1ea21bd0c6844
Signed-off-by: Kotta, Shireesha (sk434m) <sk434m@att.com>
2 files changed, 17 insertions, 5 deletions
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/CadiAuthFilter.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/CadiAuthFilter.java index 0fdc14d2..143eb0fb 100644 --- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/CadiAuthFilter.java +++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/CadiAuthFilter.java @@ -2,7 +2,7 @@ * ============LICENSE_START========================================== * ONAP Portal SDK * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2018 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -52,6 +52,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.onap.aaf.cadi.filter.CadiFilter; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.util.AuthUtil; import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; @@ -61,11 +62,14 @@ public class CadiAuthFilter extends CadiFilter { private static String include_url_endpoints =""; private static String exclude_url_endpoints = ""; public static final String AUTHORIZATION = "Authorization"; + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CadiAuthFilter.class); public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); include_url_endpoints = filterConfig.getInitParameter("include_url_endpoints"); exclude_url_endpoints = filterConfig.getInitParameter("exclude_url_endpoints"); + logger.debug(EELFLoggerDelegate.debugLogger, "inculde_url_endpoints values: "+ include_url_endpoints); + logger.debug(EELFLoggerDelegate.debugLogger, "exculde_url_endpoints values: "+ exclude_url_endpoints); } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) @@ -83,11 +87,13 @@ public class CadiAuthFilter extends CadiFilter { Arrays.asList(excludeUrlEndPointString.split(","))); ArrayList<String> includeUrlEndPointList = new ArrayList<String>( Arrays.asList(includeUrlEndPointString.split(","))); - if (excludeFilter(request, excludeUrlEndPointList)) + if (excludeFilter(request, excludeUrlEndPointList)){ + logger.debug(EELFLoggerDelegate.debugLogger, "Request excluded from cadifilter"); chain.doFilter(request, response); - else if (includeFilter(request, includeUrlEndPointList)) + }else if (includeFilter(request, includeUrlEndPointList)){ + logger.debug(EELFLoggerDelegate.debugLogger, "Request is entering cadifilter"); super.doFilter(request, response, chain); - else + }else chain.doFilter(request, response); } } diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/AuthUtil.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/AuthUtil.java index a7aa6765..14ad234f 100644 --- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/AuthUtil.java +++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/AuthUtil.java @@ -2,7 +2,7 @@ * ============LICENSE_START========================================== * ONAP Portal SDK * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2018 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -142,6 +142,7 @@ public class AuthUtil { str = decodeFunctionCode(instance); finalInstanceList.add(str); } + logger.debug(EELFLoggerDelegate.debugLogger, "List of AllInstances: "+ finalInstanceList); return finalInstanceList; } @@ -185,6 +186,11 @@ public class AuthUtil { if (!isauthorized) isauthorized = matchPattern(requestUri, str); } + logger.debug(EELFLoggerDelegate.debugLogger, "isAccessAllowed for the request uri: "+requestUri + "is"+ isauthorized); + if (isauthorized) { + logger.debug(EELFLoggerDelegate.debugLogger, + "Request is Authorized"); + } return isauthorized; } }
\ No newline at end of file |