Skip to content

Commit 8ef193e

Browse files
committed
fix[jwt]: 비밀번호 검수를 통해 재설정을 하는 로직에 레디스에 검수 여부 저장하는 부분 수정
1 parent 47dbb3d commit 8ef193e

File tree

4 files changed

+10
-25
lines changed

4 files changed

+10
-25
lines changed

backend/src/main/java/com/ai/lawyer/domain/member/controller/MemberController.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public ResponseEntity<EmailResponse> sendEmail(
198198
}
199199

200200
@PostMapping("/verifyEmail")
201-
@Operation(summary = "06. 인증번호 검증", description = "비로그인 사용자가 이메일로 받은 인증번호를 검증합니다. (비밀번호 재설정용)")
201+
@Operation(summary = "06. 인증번호 검증", description = "이메일로 받은 인증번호를 검증합니다. (비밀번호 재설정용)")
202202
@ApiResponses({
203203
@ApiResponse(responseCode = "200", description = "인증번호 검증 성공"),
204204
@ApiResponse(responseCode = "400", description = "잘못된 요청 (인증번호 불일치, loginId 없음)")
@@ -208,12 +208,6 @@ public ResponseEntity<VerificationResponse> verifyEmail(
208208
Authentication authentication
209209
) {
210210

211-
if (authentication != null && authentication.isAuthenticated() &&
212-
!"anonymousUser".equals(authentication.getPrincipal())) {
213-
log.error("로그인된 사용자의 이메일 인증 시도");
214-
throw new IllegalArgumentException("로그인된 사용자는 비밀번호 검증을 사용해야 합니다.");
215-
}
216-
217211
if (requestDto.getLoginId() == null || requestDto.getLoginId().isBlank()) {
218212
log.error("요청 바디에 loginId가 없음");
219213
throw new IllegalArgumentException("인증번호를 검증할 이메일 주소가 필요합니다.");
@@ -298,7 +292,7 @@ public ResponseEntity<VerificationResponse> verifyPassword(
298292
}
299293
}
300294

301-
@PostMapping("/password-reset/reset")
295+
@PostMapping("/passwordReset")
302296
@Operation(summary = "08. 비밀번호 재설정", description = "인증 토큰과 함께 새 비밀번호로 재설정합니다.")
303297
@ApiResponses({
304298
@ApiResponse(responseCode = "200", description = "비밀번호 재설정 성공"),

backend/src/main/java/com/ai/lawyer/global/jwt/CookieUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class CookieUtil {
1010

1111
private static final String ACCESS_TOKEN_NAME = "accessToken";
1212
private static final String REFRESH_TOKEN_NAME = "refreshToken";
13-
private static final int ACCESS_TOKEN_EXPIRE_TIME = 5 * 60; // 5분
13+
private static final int ACCESS_TOKEN_EXPIRE_TIME = 10; // 5분
1414
private static final int REFRESH_TOKEN_EXPIRE_TIME = 7 * 24 * 60 * 60; // 7일
1515

1616
public void setTokenCookies(HttpServletResponse response, String accessToken, String refreshToken) {

backend/src/main/java/com/ai/lawyer/global/jwt/JwtAuthenticationFilter.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,4 @@ private void clearAuthenticationAndCookies(HttpServletResponse response) {
178178
log.debug("인증 정보 및 쿠키 클리어 완료");
179179
}
180180

181-
/**
182-
* JWT 인증이 필요하지 않은 경로들을 필터링에서 제외합니다.
183-
* @param request HTTP 요청
184-
* @return true인 경우 필터 제외
185-
*/
186-
@Override
187-
protected boolean shouldNotFilter(HttpServletRequest request) {
188-
String path = request.getRequestURI();
189-
return path.equals("/api/auth/signup") ||
190-
path.equals("/api/auth/login") ||
191-
path.startsWith("/api/public/") ||
192-
path.startsWith("/v3/api-docs") ||
193-
path.equals("/actuator/health") ||
194-
path.startsWith("/h2-console");
195-
}
196181
}

backend/src/main/java/com/ai/lawyer/global/security/SecurityConfig.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
4040
.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin)
4141
)
4242
.authorizeHttpRequests(authorize -> authorize
43-
.requestMatchers("/api/auth/**", "/api/public/**").permitAll()
43+
.requestMatchers(
44+
"/api/auth/login",
45+
"/api/auth/signup",
46+
"/api/auth/sendEmail",
47+
"/api/auth/verifyEmail",
48+
"/api/auth/passwordReset",
49+
"/api/public/**").permitAll()
4450
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html").permitAll()
4551
.requestMatchers("/api/posts/**").permitAll()
4652
.requestMatchers("/api/precedent/**").permitAll()

0 commit comments

Comments
 (0)