로그아웃 수정, 패스워드 변경 수정

This commit is contained in:
2025-12-15 18:18:37 +09:00
parent 39ef86b218
commit a1d812a9d1
4 changed files with 14 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;
import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.web.filter.OncePerRequestFilter;
@Component @Component
@@ -19,6 +20,10 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
private final JwtTokenProvider jwtTokenProvider; private final JwtTokenProvider jwtTokenProvider;
private final UserDetailsService userDetailsService; private final UserDetailsService userDetailsService;
private static final AntPathMatcher PATH_MATCHER = new AntPathMatcher();
private static final String[] EXCLUDE_PATHS = {
"/api/auth/signin", "/api/auth/refresh", "/api/auth/logout", "/api/members/*/password"
};
@Override @Override
protected void doFilterInternal( protected void doFilterInternal(
@@ -44,10 +49,12 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
String path = request.getServletPath(); String path = request.getServletPath();
// JWT 필터를 타지 않게 할 URL 패턴들 // JWT 필터를 타지 않게 할 URL 패턴들
return path.startsWith("/api/auth/signin") for (String pattern : EXCLUDE_PATHS) {
|| path.startsWith("/api/auth/refresh") if (PATH_MATCHER.match(pattern, path)) {
|| path.startsWith("/api/auth/logout") return true;
|| path.startsWith("/api/members/*/password"); }
}
return false;
} }
// /api/members/{memberId}/password // /api/members/{memberId}/password

View File

@@ -69,6 +69,7 @@ public class SecurityConfig {
.requestMatchers( .requestMatchers(
"/api/auth/signin", "/api/auth/signin",
"/api/auth/refresh", "/api/auth/refresh",
"/api/auth/logout",
"/swagger-ui/**", "/swagger-ui/**",
"/api/members/*/password", "/api/members/*/password",
"/v3/api-docs/**") "/v3/api-docs/**")

View File

@@ -205,7 +205,7 @@ public class AuthController {
@ApiResponse( @ApiResponse(
responseCode = "200", responseCode = "200",
description = "로그아웃 성공", description = "로그아웃 성공",
content = @Content(schema = @Schema(implementation = Void.class))) content = @Content(schema = @Schema(implementation = Object.class)))
}) })
public ApiResponseDto<ResponseEntity<Object>> logout( public ApiResponseDto<ResponseEntity<Object>> logout(
Authentication authentication, HttpServletResponse response) { Authentication authentication, HttpServletResponse response) {

View File

@@ -111,7 +111,7 @@ public class MembersCoreService {
} }
String password = String password =
CommonStringUtils.hashPassword(initReq.getOldPassword(), memberEntity.getEmployeeNo()); CommonStringUtils.hashPassword(initReq.getNewPassword(), memberEntity.getEmployeeNo());
memberEntity.setPassword(password); memberEntity.setPassword(password);
memberEntity.setStatus(StatusType.ACTIVE.getId()); memberEntity.setStatus(StatusType.ACTIVE.getId());