diff options
author | Manoop Talasila <talasila@research.att.com> | 2018-05-31 20:10:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-05-31 20:10:00 +0000 |
commit | d84a85d705b38d90b73809ead3e5034b8c066ca9 (patch) | |
tree | 013346d5bbc638e84c169b681240fc4bf8ae1951 /ecomp-portal-BE-os | |
parent | 05005dbbecd71368f6bfa03db357ae123abd8061 (diff) | |
parent | e8ed77b3f1d952754f36a0258f44acecd0aceeb3 (diff) |
Merge "Changed app to redirect when the session expires."
Diffstat (limited to 'ecomp-portal-BE-os')
-rw-r--r-- | ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/interceptor/SessionTimeoutInterceptor.java | 11 |
1 files changed, 9 insertions, 2 deletions
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 +} |