Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.env
.env.*
!.env.example

target/

.idea/
*.iml

.DS_Store
Thumbs.db

*.log
logs/
36 changes: 36 additions & 0 deletions spring-security/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 과제명
JWT 인증 서버

## ⚙️ 실행 방법
1. MySQL에서 데이터베이스 생성
```sql
CREATE DATABASE security;
```

2. '.env'에 데이터베이스 정보 설정
```env
DB_URL=jdbc:mysql://localhost:3306/security?serverTimezone=Asia/Seoul&Encoding=UTF-8&&useSSL=false&allowPublicKeyRetrieval=true
DB_USERNAME=(MySQL_사용자명)
DB_USERNAME(MySQL_패스워드)

JWT_SECRET=(Base 64로 인코딩된 JWT 비밀키)
JWT_EXPIRATION_MS=3600000
```

3. Spring Boot 실행

## 💡 작업 내용
- POST /auth/register - 회원가입 구현
- POST /auth/login → JWT 토큰 수령 구현
- GET /posts (protected) → Authorization: Bearer {token} 구현

## 📡 API 명세 (Spring 과제의 경우)
| Method | URI | 설명 |
|--------|----------------|--------|
| POST | /auth/register | 회원가입 |
| POST | /auth/login | 로그인 |
| GET | /posts | 게시글 조회 |

## 🤔 느낀 점 / 어려웠던 점
- JWT의 생성, 검증, 필터 처리 과정이 여러 단계로 되어 있어 전체적인 흐름을 이해하는 데 어려웠다.
- 부족한 예외처리나 글로벌 예외처리는 시간이 좀 나면 작성해야겠다.
Binary file added spring-security/images/get_fail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spring-security/images/get_success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spring-security/images/login_fail.png

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

trace는 지금 서버 내에서 뜨는 로그 내용을 출력해주는거 같은데 저 내용을 클라이언트 입장에서 봤을 때 서버가 어떤 구조로 동작하고 어떻게 처리하는지 파악해 보안 위험이 있습니다. 그래서 클라이언트한테는 서버 로그를 보여주는 방식이 아닌 간단한 에러 메시지만 반환하고 서버로그는 서버 내부에서만 확인 가능하도록 처리하는 방식이 좋습니다.

혹시 trace 즉 서버 로그를 body값에 넘겨주는 특별한 의도가 있는지 정훈님의 의견을 들어보고 싶습니다!

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spring-security/images/login_success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spring-security/images/register_fail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spring-security/images/register_success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions spring-security/spring-security/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/mvnw text eol=lf
*.cmd text eol=crlf
33 changes: 33 additions & 0 deletions spring-security/spring-security/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
wrapperVersion=3.3.4
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip
295 changes: 295 additions & 0 deletions spring-security/spring-security/mvnw

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading