rememberMe 해결

This commit is contained in:
ckx6954 2025-01-21 21:41:35 +09:00
parent b44906ad54
commit f065991a41
2 changed files with 6 additions and 5 deletions

View File

@ -44,11 +44,6 @@ public class MemberAuthSuccessHandler implements AuthenticationSuccessHandler{
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException { public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
Boolean rememberMe = (Boolean) request.getAttribute("remember");
if (rememberMe != null && rememberMe) {
rememberMeServices.loginSuccess(request, response, authentication);
}
MemberVo member = (MemberVo) authentication.getPrincipal(); MemberVo member = (MemberVo) authentication.getPrincipal();
response.setStatus(HttpStatus.OK.value()); response.setStatus(HttpStatus.OK.value());
response.setContentType(MediaType.APPLICATION_JSON_VALUE); response.setContentType(MediaType.APPLICATION_JSON_VALUE);

View File

@ -92,6 +92,12 @@ public class CustomRememberMeServices implements RememberMeServices {
@Override @Override
public void loginSuccess(HttpServletRequest request, HttpServletResponse response, Authentication successfulAuthentication) { public void loginSuccess(HttpServletRequest request, HttpServletResponse response, Authentication successfulAuthentication) {
Boolean rememberMe = (Boolean) request.getAttribute("remember");
if(!rememberMe){
return;
}
Object principal = successfulAuthentication.getPrincipal(); Object principal = successfulAuthentication.getPrincipal();
if (!(principal instanceof MemberVo member)) { if (!(principal instanceof MemberVo member)) {
return; return;