mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-06 18:30:57 +00:00
Update AnonymusSessionStatusController.java
This commit is contained in:
parent
2101d21a78
commit
ce1d153a71
@ -3,14 +3,17 @@ package stirling.software.SPDF.config.anonymus.session;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
|
||||||
@RestController
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@Slf4j
|
||||||
public class AnonymusSessionStatusController {
|
public class AnonymusSessionStatusController {
|
||||||
|
|
||||||
@Autowired private AnonymusSessionListener sessionRegistry;
|
@Autowired private AnonymusSessionListener sessionRegistry;
|
||||||
@ -50,15 +53,18 @@ public class AnonymusSessionStatusController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/session/expire")
|
@GetMapping("/session/expire")
|
||||||
public ResponseEntity<String> expireSession(HttpServletRequest request) {
|
public String expireSession(HttpServletRequest request) {
|
||||||
HttpSession session = request.getSession(false);
|
HttpSession session = request.getSession(false);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
// Invalidate current session
|
// Invalidate current session
|
||||||
sessionRegistry.expireSession(session.getId());
|
sessionRegistry.expireFirstSession(session.getId());
|
||||||
return ResponseEntity.ok("Session invalidated");
|
log.info("Session invalidated: {}", session.getId());
|
||||||
|
// return ResponseEntity.ok("Session invalidated");
|
||||||
} else {
|
} else {
|
||||||
return ResponseEntity.ok("No session to invalidate");
|
log.info("No session to invalidate");
|
||||||
|
// return ResponseEntity.ok("No session to invalidate");
|
||||||
}
|
}
|
||||||
|
return "redirect:/";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/session/expire/all")
|
@GetMapping("/session/expire/all")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user