From ea37c0eb6f4f93596135035b0e34f29599735c32 Mon Sep 17 00:00:00 2001 From: Jorge Hernandez Date: Wed, 19 Sep 2018 14:22:28 -0500 Subject: tweaks from testing in auth classes Change-Id: Idb1346ca645ffcc55808e25c8957e01d27a48a75 Signed-off-by: Jorge Hernandez Issue-ID: POLICY-1043 --- .../onap/policy/common/endpoints/http/server/AuthorizationFilter.java | 2 +- .../policy/common/endpoints/http/server/aaf/AafGranularAuthFilter.java | 3 +-- .../common/endpoints/http/server/test/TestAafGranularAuthFilter.java | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'policy-endpoints') diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/AuthorizationFilter.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/AuthorizationFilter.java index cb58371f..d884b869 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/AuthorizationFilter.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/AuthorizationFilter.java @@ -54,7 +54,7 @@ public abstract class AuthorizationFilter implements Filter { boolean authorized = request.isUserInRole(role); logger.info("user {} in role {} is {}authorized to {}", - request.getUserPrincipal().getName(), role, ((authorized) ? "" : "NOT "), request.getMethod()); + request.getUserPrincipal(), role, ((authorized) ? "" : "NOT "), request.getMethod()); if (!authorized) { response.setStatus(HttpServletResponse.SC_FORBIDDEN); diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/aaf/AafGranularAuthFilter.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/aaf/AafGranularAuthFilter.java index 42df2484..27b15a9c 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/aaf/AafGranularAuthFilter.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/aaf/AafGranularAuthFilter.java @@ -36,8 +36,7 @@ public abstract class AafGranularAuthFilter extends AafAuthFilter { @Override protected String getPermissionType(HttpServletRequest request) { - return getPermissionTypeRoot() + "." + - request.getRequestURI().replace('/', '.'); + return getPermissionTypeRoot() + request.getRequestURI().replace('/', '.'); } @Override diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/TestAafGranularAuthFilter.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/TestAafGranularAuthFilter.java index cad6fb5c..183e5ae7 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/TestAafGranularAuthFilter.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/TestAafGranularAuthFilter.java @@ -28,7 +28,7 @@ public class TestAafGranularAuthFilter extends AafGranularAuthFilter { @Override protected String getRole(HttpServletRequest request) { - String expectedPerm = this.getPermissionTypeRoot() + "." + String expectedPerm = this.getPermissionTypeRoot() + request.getRequestURI().replace('/', '.') + "|" + NetworkUtil.getHostname() + "|" + request.getMethod().toLowerCase(); -- cgit 1.2.3-korg