From fe25bf3a040455e931a9f5f61ff913ce78db1d69 Mon Sep 17 00:00:00 2001 From: "Kishore Reddy, Gujja (kg811t)" Date: Fri, 11 May 2018 16:08:49 -0400 Subject: Fixes in SDK AAF JAR Issue-ID: PORTAL-281 Portal SDK AAF jar throws null pointer exception Change-Id: Icdbd5a254221994a921fd9b58e8ca6786956273d Signed-off-by: Kishore Reddy, Gujja (kg811t) --- .../service/LoginExternalAuthServiceImpl.java | 2 + .../authorization/service/UserApiServiceImpl.java | 46 ++++++++++++---------- ecomp-sdk/epsdk-app-os/README.md | 1 + 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java index d2ccfc2e..063c207f 100644 --- a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java @@ -59,6 +59,7 @@ import org.onap.portalsdk.core.web.support.AppUtils; import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service("loginExternalAuthService") public class LoginExternalAuthServiceImpl implements LoginExternalAuthService { @@ -79,6 +80,7 @@ public class LoginExternalAuthServiceImpl implements LoginExternalAuthService { @Override @SuppressWarnings("rawtypes") + @Transactional public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, Map additionalParams, boolean matchPassword, HttpServletRequest request) throws Exception { diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java index 8425f7da..32a7421f 100644 --- a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java @@ -71,6 +71,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.client.RestTemplate; import com.fasterxml.jackson.databind.ObjectMapper; @@ -103,6 +104,7 @@ public class UserApiServiceImpl implements UserApiService { private AppService appService; @Override + @Transactional public User getUser(String orgUserId, HttpServletRequest request) throws UserNotFoundException { User user = null; @@ -207,28 +209,30 @@ public class UserApiServiceImpl implements UserApiService { role.setPriority(Integer.valueOf(roleDesc.getPriority())); } } - for (ExternalAccessPerms extPerm : roleDesc.getPermissions()) { - RoleFunction roleFunction = new RoleFunction(); - roleFunction.setCode(extPerm.getInstance()); - roleFunction.setAction(extPerm.getAction()); - if (extPerm.getDescription() != null - && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { - roleFunction.setName(extPerm.getDescription()); - } else if (extPerm.getDescription() == null - && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { - roleFunction.setName(extPerm.getType().substring(namespace.length() + 1) + "|" - + extPerm.getInstance() + "|" + extPerm.getAction()); - } else if (extPerm.getDescription() == null - && !EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { - roleFunction.setName( - extPerm.getType() + "|" + extPerm.getInstance() + "|" + extPerm.getAction()); + if (roleDesc.getPermissions() != null) { + for (ExternalAccessPerms extPerm : roleDesc.getPermissions()) { + RoleFunction roleFunction = new RoleFunction(); + roleFunction.setCode(extPerm.getInstance()); + roleFunction.setAction(extPerm.getAction()); + if (extPerm.getDescription() != null + && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setName(extPerm.getDescription()); + } else if (extPerm.getDescription() == null + && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setName(extPerm.getType().substring(namespace.length() + 1) + "|" + + extPerm.getInstance() + "|" + extPerm.getAction()); + } else if (extPerm.getDescription() == null + && !EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setName( + extPerm.getType() + "|" + extPerm.getInstance() + "|" + extPerm.getAction()); + } + if (EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setType(extPerm.getType().substring(namespace.length() + 1)); + } else { + roleFunction.setType(extPerm.getType()); + } + roleFunctions.add(roleFunction); } - if (EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { - roleFunction.setType(extPerm.getType().substring(namespace.length() + 1)); - } else { - roleFunction.setType(extPerm.getType()); - } - roleFunctions.add(roleFunction); } } role.setRoleFunctions(roleFunctions); diff --git a/ecomp-sdk/epsdk-app-os/README.md b/ecomp-sdk/epsdk-app-os/README.md index c61ebe63..675919bb 100644 --- a/ecomp-sdk/epsdk-app-os/README.md +++ b/ecomp-sdk/epsdk-app-os/README.md @@ -14,6 +14,7 @@ https://www.eclipse.org/m2e-wtp/ ## Release Notes Version 2.3.0 - PORTAL 254 ECOMP AAF jar +- PORTAL-281 Portal SDK AAF jar throws null pointer exception Version 2.2.0 - PORTAL 136 Junits for SDK -- cgit 1.2.3-korg