rememberMe 해결
This commit is contained in:
parent
b44906ad54
commit
f065991a41
@ -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);
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user