Skip to content

[feat] #5 - swagger & security config 추가 - #6

Merged
aneykrap merged 6 commits into
developfrom
feat/#5-swagger-security-config
Jun 28, 2026
Merged

aneykrap merged 6 commits into
developfrom
feat/#5-swagger-security-config

Conversation

@aneykrap

@aneykrap aneykrap commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

관련 이슈 🛠

작업 내용 요약 ✏️

  • Swagger를 통한 API 문서화 환경과 Spring Security 기본 설정을 추가했습니다.
  • build.gardle 주석도 추가했습니다.

주요 변경 사항 🛠️

  • [Swagger]: springdoc-openapi 의존성 및 OpenAPI 기본 정보 설정
  • [Security]: Stateless 기반 SecurityFilterChain 구성
  • [Security]: CSRF, Form Login, HTTP Basic 비활성화
  • [Security]: Swagger UI 및 OpenAPI 문서 경로 접근 허용
  • [Build]: build.gradle 의존성을 기능별 주석으로 구분
  • [설정]: 인증 기능 구현 전 단계이므로 현재 모든 API 요청을 임시 허용

트러블 슈팅 ⚽️

JPA 의존성이 존재하지만 DataSource 설정이 없어 애플리케이션 실행 시 다음 오류가 발생했고

Failed to configure a DataSource
Failed to determine a suitable driver class

Swagger와 Security 설정을 우선 확인하기 위해 로컬 application.yml에서 DataSource 자동 설정을 임시 제외했습니다.

  spring:
    autoconfigure:
      exclude:
        - org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration

설정은 DB 연동 전까지 사용하는 임시 로컬 설정이고 이번 PR에는 포함하지 않았어요

테스트 결과 📄

  • Swagger UI 접근 확인
  • Security 적용 후에도 Swagger 문서 접근 가능 확인

스크린샷 📷

추가예정

리뷰 요구사항 📢

  • 인증 기능이 구현 전이라 anyRequest().permitAll()로 설정했습니다. JWT 인증 구현 시 인증이 필요한 요청을 authenticated()로 변경해주시면 될것 같아요
  • 기본적으로 세팅 해둔 상태여서 혹시 빼먹은 내용, 필요한 내용이 있다면 알려주시면 감사하겠습니다.
  • application.yml 파일 세팅은 일단 노션에 올려뒀습니다. (임시설정)

📎 참고 자료 (선택)

지금 application.yml이 gitignore에 들어가 있어서 나중에 공통으로 추가되는 설정들이 생기면 팀원들이 각자 따로 맞춰야 할 수도 있을 것 같아요

앞으로 DB나 배포 관련 설정도 추가될 수 있어서 미리 관리 방식을 한번 정해두면 좋을 것 같아요. 관련해서 찾아본 블로그가 있는데 티모 규모에는 어떤 방식이 괜찮을지 데일리 스크럼 때 같이 얘기해보면 좋겠습니다!

참고블로그

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • OpenAPI UI(문서 페이지)가 추가되어 서비스 API를 브라우저에서 바로 확인할 수 있으며, 문서의 제목/설명/버전 정보가 함께 제공됩니다.
  • Bug Fixes

    • 요청 보안 구성이 정리되어 API 문서 관련 경로는 원활히 접근되도록 했고, 전반적인 접근 규칙도 일관되게 적용됩니다.
  • Chores

    • 빌드 및 의존성 구성이 개선되어 웹/테스트 관련 설정이 더 간결해졌습니다.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6d600ea9-d63b-4497-a78a-11d0f03e525f

📥 Commits

Reviewing files that changed from the base of the PR and between 4939707 and 517ed99.

📒 Files selected for processing (3)
  • build.gradle
  • src/main/java/com/Timo/Timo/global/config/SecurityConfig.java
  • src/main/java/com/Timo/Timo/global/config/SwaggerConfig.java
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/java/com/Timo/Timo/global/config/SwaggerConfig.java
  • build.gradle

📝 Walkthrough

Walkthrough

Swagger 의존성과 OpenAPI 정보 설정이 추가됐고, Spring Boot 플러그인 및 테스트 의존성이 정리됐다. 또한 Spring Security 기본 필터 체인이 새로 등록되어 CSRF, form login, http basic을 끄고 Swagger 경로와 전체 요청을 허용하도록 구성됐다.

Changes

Swagger 및 Security 설정

Layer / File(s) Summary
의존성과 OpenAPI 설정
build.gradle, src/main/java/com/Timo/Timo/global/config/SwaggerConfig.java
Spring Boot 플러그인 버전이 변경되고, 웹·보안·문서화·테스트 의존성이 재구성되며, SwaggerConfig가 OpenAPI title, description, version을 설정하는 빈을 등록한다.
기본 Security 필터 체인
src/main/java/com/Timo/Timo/global/config/SecurityConfig.java
SecurityFilterChain이 추가되어 CSRF, formLogin, httpBasic이 비활성화되고 세션 정책이 stateless로 설정되며 Swagger 관련 경로와 전체 요청이 허용된다.

Estimated review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

토끼가 깡총, 문서가 반짝 🐰
스웨거 길목에 표지가 섰네
보안 문도 살짝 열어 두고
API 바람이 살랑살랑 오네
당근 한 입에 리뷰도 가볍네

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 Swagger와 Security 설정 추가라는 주요 변경을 간결하게 요약합니다.
Linked Issues check ✅ Passed Swagger 의존성, SwaggerConfig, 기본 SecurityConfig가 추가되어 링크된 #5의 요구사항을 충족합니다.
Out of Scope Changes check ✅ Passed 빌드 의존성 정리와 웹/테스트 의존성 조정도 Swagger·Security 설정에 필요한 범위로 보이며 명확한 이탈은 없습니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@Jy000n Jy000n left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

고생하셨습니당🌵

Comment thread build.gradle Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

P2) 솝트 1차 과제 제출 페이지를 구경하다가(어느 팀인지는 기억이 안 나지만,,) 현재 최신 버전인 Spring Boot 4.1.x는 일부 주요 라이브러리의 호환성이 아직 충분히 검증되지 않았다는 내용을 본 적이 있습니다. 프로젝트의 안정적인 개발과 운영을 위해 조금 더 검증된 버전으로 사용하는 것도 괜찮을 것 같습니다..!!

찾아본 바로는 OAuth2와 Spring Security 관련 예제나 자료들이 대부분 Spring Boot 3.x를 기준으로 작성되어 있어서 참고할 자료도 많고, 호환성 측면에서도 장점이 있는 것 같습니다. 다만 제가 봤던 팀은 4.0.x 버전을 사용했던 것 같기도 해서, 이 부분은 한 번 같이 확인해 보면 좋을 것 같습니다!

@aneykrap aneykrap Jun 27, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

오 글쿤요 요것도 한번 확인 한 뒤 제가 바꾸는것 보다는 다같이 다시 이야기 해보면 좋을것 같습니당 감사합니당

Comment thread build.gradle Outdated
Comment on lines 42 to 44
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa-test'
testImplementation 'org.springframework.boot:spring-boot-starter-validation-test'
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

P4) 테스트 의존성이 개별 패키지로 추가되어 있는 것 같은데, spring-boot-starter-test를 사용하면 대부분의 테스트 라이브러리가 함께 포함되어 관리하기 편한 것으로 알고 있습니다!!. 특별한 이유가 없다면 해당 스타터를 사용하는 것도 고려해 보면 좋을 것 같습니당

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

오 대박! 바로 수정하겠습니당 감사합니당!

laura-jung
laura-jung previously approved these changes Jun 27, 2026

@laura-jung laura-jung left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

확인 완료했습니다.
아직 프로젝트 적으로 개발된 게 없어서 다 허용으로 열어두신 것 같은데 TODO 주석 활용하여 후에 수정을 염두해두는게 좋을 것 같아요!

수고하셨습니다!

"/swagger-ui.html",
"/v3/api-docs/**"
).permitAll()
.anyRequest().permitAll());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

p4)anyRequest().permitAll()은 인증 기능 구현 전 임시 설정으로는 좋은 것 같습니다

다만 이 상태로 머지되면 이후 추가되는 API도 기본적으로 모두 공개되기 때문에, JWT 적용 시점에 놓치지 않도록 TODO 주석을 남겨놓으면 좋을 것 같아요!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

네넹 요건 todo 주석 남겨두도록 하겠습니다.
감사합니다

Comment thread build.gradle

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gradle 분류 작업 해주셔서 감사합니다.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
build.gradle (1)

34-35: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Spring Boot 3.x에 맞는 springdoc 2.x로 내려야 합니다. springdoc-openapi-starter-webmvc-ui:3.0.3는 Spring Boot 4.x 라인입니다. 현재 Spring Boot 3.5.15와 섞으면 Swagger 초기화/부팅 단계에서 호환성 문제가 날 수 있으니 2.8.17 같은 2.x로 맞추세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@build.gradle` around lines 34 - 35, The API documentation dependency is on
the wrong springdoc major version for the current Spring Boot 3.x setup. Update
the dependency in build.gradle from springdoc-openapi-starter-webmvc-ui:3.0.3 to
a compatible 2.x release such as 2.8.17, keeping the change localized to the
Swagger/OpenAPI dependency declaration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@build.gradle`:
- Around line 34-35: The API documentation dependency is on the wrong springdoc
major version for the current Spring Boot 3.x setup. Update the dependency in
build.gradle from springdoc-openapi-starter-webmvc-ui:3.0.3 to a compatible 2.x
release such as 2.8.17, keeping the change localized to the Swagger/OpenAPI
dependency declaration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c18a2111-19f6-4a5e-aa43-3d1e846a49fe

📥 Commits

Reviewing files that changed from the base of the PR and between 27615fc and 677831c.

📒 Files selected for processing (2)
  • build.gradle
  • src/main/java/com/Timo/Timo/global/config/SecurityConfig.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/Timo/Timo/global/config/SecurityConfig.java

@Jy000n Jy000n left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

굳굳 좋아용

@aneykrap
aneykrap force-pushed the feat/#5-swagger-security-config branch from 4939707 to 517ed99 Compare June 28, 2026 06:46
@aneykrap
aneykrap requested a review from laura-jung June 28, 2026 06:50
@aneykrap
aneykrap merged commit 42649b0 into develop Jun 28, 2026
1 of 3 checks passed
@aneykrap aneykrap changed the title feat : swagger & security config 추가 [feat] #5 - swagger & security config 추가 Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] Swagger 및 Security Config 설정

3 participants