Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix #33] 시류리티 config 변경 및 API 인증 예외 처리 #35

Merged
merged 9 commits into from
Aug 12, 2024

Conversation

dudxo
Copy link
Collaborator

@dudxo dudxo commented Aug 12, 2024

관련 이슈

📑 작업 상세 내용

  • security config 인가 허용 API 제거
  • seucirty 예외 처리 클래스 로직 변경
    • 인증 리소스 접근에 대한 비인가 요청 예외처리 CustomAuthenticationEntryPoint.class 로직 수정
    • JWT 검증 시 발생하는 예외 처리 필터 TokenAuthenticationFilter.class 로직 수정
  • CORS 커스텀 적용을 위한 CORS disable -> able
  • SecurityErrorCode 생성
  • JwtErroCode 파일 위치 변경
    • security.jwt.exception -> security.exception

💫 작업 요약

  • security config 인가 허용 API 제거
  • seucirty 예외 처리 클래스 로직 변경
  • CORS 커스텀 적용을 위한 CORS disable -> able

🔍 중점적으로 리뷰 할 부분

@dudxo dudxo added the 빠른 리뷰! 빠른 PR 리뷰가 필요할 때 label Aug 12, 2024
@dudxo dudxo self-assigned this Aug 12, 2024
@dudxo dudxo linked an issue Aug 12, 2024 that may be closed by this pull request
2 tasks
Copy link

github-actions bot commented Aug 12, 2024

Test Results

43 tests   37 ✅  5s ⏱️
14 suites   6 💤
14 files     0 ❌

Results for commit 9e85368.

♻️ This comment has been updated with latest results.

Copy link
Member

@hyun2371 hyun2371 left a comment

Choose a reason for hiding this comment

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

고생 많으셨습니다🙂

@@ -35,7 +36,7 @@ public WebSecurityCustomizer webSecurityCustomizer() {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.cors((auth) -> auth.disable())
.cors(Customizer.withDefaults())
Copy link
Member

Choose a reason for hiding this comment

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

위 코드는 어떤건지 설명해주실 수 있을까요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cors 비허용했다가 이를 기본값으로 설정해주도록 변경했는데, 제가 커스텀한 cors가 제대로 작동이 안될때가 있는것 같습니다.
수정 하겠습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

WebConfig를 통해 cors 정책을 커스텀 했는데, 이건 Spring MVC에서만 사용되고, Secuirty에서는 적용되지 않을수도 있었네요
그래서 custom corsConfigurationSource Bean을 등록해서 Security에서도 커스텀 cors 정책이 적용되도록 수정했습니다!

@dudxo dudxo merged commit dc97d4c into dev Aug 12, 2024
3 checks passed
@dudxo dudxo deleted the fix/#33/security branch August 13, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
빠른 리뷰! 빠른 PR 리뷰가 필요할 때
Projects
None yet
Development

Successfully merging this pull request may close these issues.

⚙️ Security 관련 배포 스크립트 변경
2 participants