Last active
June 17, 2017 18:57
Star
You must be signed in to star a gist
Dynamically set session expiry based on the user type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DynamicSessionIdentifierStrategy implements HttpSessionStrategy { | |
private static CookieHttpSessionStrategy cookieHttpSessionStrategy = | |
new CookieHttpSessionStrategy(); | |
/* Code redacted */ | |
@Override | |
public void onNewSession(Session session, HttpServletRequest httpServletRequest, | |
HttpServletResponse httpServletResponse) { | |
if (!principalManager.isLoggedIn()) { | |
return; | |
} | |
int timeOut = principalManager.isInternalUser() ? 1000 : 100 | |
session.setMaxInactiveIntervalInSeconds(timeOut); | |
cookieHttpSessionStrategy.onNewSession(session, httpServletRequest, | |
httpServletResponse) | |
} | |
/* Code redacted */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment