메인페이지 유저승인 api 변경
All checks were successful
LOCALNET-DEV/pipeline/head This commit looks good

This commit is contained in:
nevermoregb 2025-04-10 13:42:05 +09:00
parent 7eaa24e4fc
commit 163fdb34cb

View File

@ -30,9 +30,11 @@ import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.context.SecurityContextHolderStrategy; import org.springframework.security.core.context.SecurityContextHolderStrategy;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RequestPart;
@ -241,6 +243,9 @@ public class UserController {
return null; return null;
} }
// @GetMapping("checkUserSession")
// public
// 유저 세션 체크 // 유저 세션 체크
@ -257,6 +262,21 @@ public class UserController {
} }
return ApiResponse.ok(sessionData); return ApiResponse.ok(sessionData);
} }
// 유저 세션 권한 체크
@PostMapping(value = "authCheck")
public ApiResponse<?> authCheck(@ReqMap MapDto map) {
String memberId = map.getString("memberId");
if(!StringUtils.hasText(memberId)) return ApiResponse.error(HttpStatus.BAD_REQUEST, "파라미터 오류");
String userRole = "";
MemberVo vo = AuthUtil.getUser();
if(vo != null && memberId.equals(vo.getLoginId())) {
userRole = vo.getRole();
}
return ApiResponse.ok(userRole);
}
// rememberMe 확인용 // rememberMe 확인용
@GetMapping(value = "rememberCheck") @GetMapping(value = "rememberCheck")