refactor: centralise session key format in SessionKeys utility

This commit is contained in:
2026-05-21 20:57:32 +02:00
parent 1a86c23565
commit 5776676eeb
3 changed files with 20 additions and 8 deletions
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.vaessl.app.connection.SessionKeys;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import jakarta.validation.Valid;
@@ -30,7 +31,7 @@ public class SearchController {
@PageableDefault(size = 20) Pageable pageable, HttpServletRequest httpReq) {
HttpSession session = httpReq.getSession(false);
if (session == null
|| session.getAttribute(request.serviceType() + "_CONNECTION_ID") == null) {
|| session.getAttribute(SessionKeys.connectionId(request.serviceType())) == null) {
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
}