Skip to content

chore: 시큐리티 필터 url 수정및 리프레시 토큰 값 일정 문제 해결#144

Open
Fluteen wants to merge 2 commits intodevelopfrom
chore/21-modify-security-filter-auth
Open

chore: 시큐리티 필터 url 수정및 리프레시 토큰 값 일정 문제 해결#144
Fluteen wants to merge 2 commits intodevelopfrom
chore/21-modify-security-filter-auth

Conversation

@Fluteen
Copy link
Contributor

@Fluteen Fluteen commented Sep 2, 2025

작업 내용

  • auth 관련 요청 모두 허용하는 대신 로그인만 가능하도록 url 주소 변경했습니다.
  • url 수정하면서 Filter에 refresh token 값이 일정했던 문제까지 같이 해결했습니다

특이 사항 (리뷰 시 참고할 내용)

관련 이슈

close #21 , #37

.requestMatchers("/signup").permitAll()

// 로그아웃은 로그인 이후 가능
.requestMatchers("members/me/logout").hasAnyAuthority("일반", "관리자")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

로그아웃 url "/auth/logout" 이지 않나요..?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 그렇네요.. 마이페이지에서 로그아웃하는 것만 생각나서.. 이렇게 했나봐요 감사합니다ㅎㅎ

// 인증 없이 로그인,회원가입은 가능.
.requestMatchers("/swagger-ui/**", "/v3/api-docs/**").permitAll()
.requestMatchers("/auth/**", "/email/**").permitAll()
.requestMatchers("/auth/login", "/email/**").permitAll()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 프론트에서 어떻게 사용하는지 몰라서 물어봅니당
login만 허용해도 비밀번호 변경 관련 메서드("/auth/password/update-link/send", "auth/password") 는 비로그인상태에서도 사용 가능한건가요?? 아시는 분...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분도 이슈만 보면서 고치다가 이슈 후에 추가된 controller는 보지 못하고 추가하다가 이렇게 된 것 같습니다..! 저 링크들을 다 포함해야 될 것 같아서 추가하는게 맞겠네요!

Copy link
Contributor

@yuuuyeonho yuuuyeonho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

Copy link
Member

@kckc0608 kckc0608 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!! 리뷰가 많이 늦었네요 ㅠㅠ

Comment on lines +128 to +142
// Swagger 전용 다시 시도
if (!authenticated && bearerAccessToken != null) {
tokenUtil.validateToken(bearerAccessToken);

String studentId = tokenUtil.getStudentIdFromToken(bearerAccessToken);
String status = tokenUtil.getStatusFromToken(bearerAccessToken);

SecurityContextHolder.getContext().setAuthentication(
new UsernamePasswordAuthenticationToken(
studentId,
null,
List.of(new SimpleGrantedAuthority(status))
)
);
authenticated = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 스웨거 검증 로직이 따로 있는 이유가 있을까요?
엑세스 토큰을 검증하는 로직이 동일한 것 같아서, 엑세스 토큰, 리프레시 토큰이 모두 없다면 -> 헤더 체크해서 엑세스 토큰 세팅하고 -> 엑세스 토큰이 있다면 검증 수행 과 같은 플로우로 가도 괜찮지 않을까 생각했어요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

시큐리티 필터에서 로그인 이외 url 에 대해 인증 요구하도록 변경

3 participants