Update SessionStatusController.java

This commit is contained in:
Ludy87 2025-03-27 13:13:13 +01:00
parent 287a815793
commit 355c09e509
No known key found for this signature in database
GPG Key ID: 92696155E0220F94

View File

@ -15,14 +15,11 @@ import org.springframework.web.bind.annotation.RestController;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import stirling.software.SPDF.config.security.UserUtils;
import stirling.software.SPDF.config.security.session.SessionPersistentRegistry;
@RestController
@Slf4j
public class SessionStatusController {
@Autowired private SessionPersistentRegistry sessionPersistentRegistry;
@ -59,10 +56,8 @@ public class SessionStatusController {
"User: " + username + " has " + userSessions + " sessions");
}
} else {
log.info("Session ungültig oder abgelaufen");
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Session ungültig oder abgelaufen");
}
return ResponseEntity.status(HttpStatus.UNAUTHORIZED)
.body(sessionPersistentRegistry.getAllSessionsNotExpired().size() + "");
}
@GetMapping("/session/expire")