Spring sessions with Redis

Hi, I have these 2 endpoints:
@GetMapping("/signin")
public ResponseEntity<String> signIn(@RequestParam String username, @RequestParam String password) {
    var auth = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password));
    SecurityContextHolder.getContext().setAuthentication(auth);
    return ResponseEntity.ok("Done");
}

@GetMapping("/signup")
public ResponseEntity<Boolean> check() {
    var authentication = SecurityContextHolder.getContext().getAuthentication();
    return ResponseEntity.ok(authentication != null && authentication.isAuthenticated());
}

but when i try the second one after the first one, it always returns false. why?
auth.isAuthenticated()
is true when debugged
Was this page helpful?