Signed-off-by: a <a>
This commit is contained in:
a 2024-09-20 13:35:37 +01:00
parent 04a6ebf515
commit f9677b1fe8
3 changed files with 21 additions and 22 deletions

View File

@ -56,17 +56,17 @@ public class UserAuthenticationFilter extends OncePerRequestFilter {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
// Check for session expiration (unsure if needed) // Check for session expiration (unsure if needed)
// if (authentication != null && authentication.isAuthenticated()) { // if (authentication != null && authentication.isAuthenticated()) {
// String sessionId = request.getSession().getId(); // String sessionId = request.getSession().getId();
// SessionInformation sessionInfo = // SessionInformation sessionInfo =
// sessionPersistentRegistry.getSessionInformation(sessionId); // sessionPersistentRegistry.getSessionInformation(sessionId);
// //
// if (sessionInfo != null && sessionInfo.isExpired()) { // if (sessionInfo != null && sessionInfo.isExpired()) {
// SecurityContextHolder.clearContext(); // SecurityContextHolder.clearContext();
// response.sendRedirect(request.getContextPath() + "/login?expired=true"); // response.sendRedirect(request.getContextPath() + "/login?expired=true");
// return; // return;
// } // }
// } // }
// Check for API key in the request headers if no authentication exists // Check for API key in the request headers if no authentication exists
if (authentication == null || !authentication.isAuthenticated()) { if (authentication == null || !authentication.isAuthenticated()) {

View File

@ -26,11 +26,10 @@ public class CustomHttpSessionListener implements HttpSessionListener {
@Override @Override
public void sessionCreated(HttpSessionEvent se) { public void sessionCreated(HttpSessionEvent se) {
log.info( log.info(
"Session created: {} with count {}", "Session created: {} with count {}",
se.getSession().getId(), se.getSession().getId(),
activeSessions.incrementAndGet()); activeSessions.incrementAndGet());
} }
@Override @Override

View File

@ -85,12 +85,12 @@ public class SessionPersistentRegistry implements SessionRegistry {
if (principalName != null) { if (principalName != null) {
// Clear old sessions for the principal (unsure if needed) // Clear old sessions for the principal (unsure if needed)
// List<SessionEntity> existingSessions = // List<SessionEntity> existingSessions =
// sessionRepository.findByPrincipalName(principalName); // sessionRepository.findByPrincipalName(principalName);
// for (SessionEntity session : existingSessions) { // for (SessionEntity session : existingSessions) {
// session.setExpired(true); // session.setExpired(true);
// sessionRepository.save(session); // sessionRepository.save(session);
// } // }
SessionEntity sessionEntity = new SessionEntity(); SessionEntity sessionEntity = new SessionEntity();
sessionEntity.setSessionId(sessionId); sessionEntity.setSessionId(sessionId);