From e8ed77b3f1d952754f36a0258f44acecd0aceeb3 Mon Sep 17 00:00:00 2001 From: William Kurkian Date: Tue, 8 May 2018 11:59:38 -0400 Subject: Changed app to redirect when the session expires. Reverted previous change to redirect from incorrect login screens. Instead, navigating to the main application page without a valid session results in being sent to the login page Removed some mistaken changes These didn't relate to the fix Issue-ID: PORTAL-278 Change-Id: I82c4a1ed26ede0119cdc4d1f9b818780ca876801 Signed-off-by: William Kurkian --- .../portal/interceptor/SessionTimeoutInterceptor.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'ecomp-portal-BE-os') diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/interceptor/SessionTimeoutInterceptor.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/interceptor/SessionTimeoutInterceptor.java index d0d3d48c..dd201edd 100644 --- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/interceptor/SessionTimeoutInterceptor.java +++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/interceptor/SessionTimeoutInterceptor.java @@ -52,6 +52,8 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalapp.portal.utils.EPSystemProperties; public class SessionTimeoutInterceptor extends HandlerInterceptorAdapter { EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SessionTimeoutInterceptor.class); @@ -79,7 +81,9 @@ public class SessionTimeoutInterceptor extends HandlerInterceptorAdapter { if (!controller.isAccessible()) { try { EPUser user = EPUserUtils.getUserSession(request); - + if (user == null) { + throw new SessionExpiredException(); + } if (request.getRequestURI().indexOf("logout.htm") > -1) { CollaborateList.delUserName(user.getOrgUserId()); throw new SessionExpiredException(); @@ -87,6 +91,9 @@ public class SessionTimeoutInterceptor extends HandlerInterceptorAdapter { resetSessionMaxIdleTimeOut(request); CollaborateList.addUserName(user.getOrgUserId()); } + } catch (SessionExpiredException e) { + response.sendRedirect(SystemProperties.getProperty(EPSystemProperties.LOGIN_URL_NO_RET_VAL)); + return false; } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "preHandle failed", e); return false; @@ -115,4 +122,4 @@ public class SessionTimeoutInterceptor extends HandlerInterceptorAdapter { return true; return false; } -} \ No newline at end of file +} -- cgit 1.2.3-korg