-
Notifications
You must be signed in to change notification settings - Fork 0
[Gibeom] Week9 미션 #106
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
base: main
Are you sure you want to change the base?
[Gibeom] Week9 미션 #106
Changes from all commits
0df2bcb
fdc4ba8
1e35650
1c599ee
397f3a9
b90c45f
487ba8e
9beb252
8627cd5
f2bd85a
58b0f08
c27c02e
88d1525
288d256
380bc8d
bcee1ae
8ad2b46
4677dbf
e4640d2
7af73d2
5fcaa5a
ca7c6f0
8a210a3
9d4505c
9c4dfb8
725df87
f9e0cd9
937957f
539caae
438566d
55ac5af
3dc7122
84af938
2be1a91
947ab52
65b263a
f0ca08d
1909e62
d850ad7
01e87fb
00e45b6
1b7ccc7
088b79e
6c0524a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .idea/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #Thu Apr 30 21:19:35 KST 2026 | ||
| gradle.version=9.4.1 | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| name: CI/CD Pipeline (.jar) | ||
|
|
||
| on: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 워크플로 파일이 |
||
| push: | ||
| branches: [ "main" ] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: main 체크아웃 | ||
| uses: actions/checkout@v4 # 체크아웃 | ||
|
|
||
| - name: 자바 설정 # Java 개발 킷 설정 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '21' | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 현재 job은 저장소 루트에서 실행되지만 |
||
| - name: gradlew 실행 권한 부여 | ||
| run: chmod +x gradlew | ||
|
|
||
| - name: gradle 세팅 | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: gradle 빌드 | ||
| run: ./gradlew build -x test | ||
|
|
||
| - name: 빌드된 아티팩트 업로드 | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: BackEnd | ||
| path: build/libs/*.jar | ||
|
|
||
| deploy: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: 아티팩트 다운로드 | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: BackEnd | ||
| path: build/libs/ | ||
|
|
||
| - name: EC2 배포 | ||
| env: | ||
| EC2_SSH_KEY: ${{ secrets.EC2_SSH_KEY }} | ||
| EC2_USERNAME: ${{ secrets.EC2_USERNAME }} | ||
| EC2_HOST: ${{ secrets.EC2_HOST }} | ||
| ENV: ${{ secrets.ENV }} | ||
| run: | | ||
| echo "$EC2_SSH_KEY" > private_key.pem | ||
| chmod 600 private_key.pem | ||
| jar_file=$(find build/libs -name '*.jar' ! -name '*plain.jar' | head -n 1) | ||
| scp -i private_key.pem -o StrictHostKeyChecking=no "$jar_file" $EC2_USERNAME@$EC2_HOST:/home/$EC2_USERNAME/BackEnd.jar | ||
| echo "$ENV" | ssh -i private_key.pem -o StrictHostKeyChecking=no $EC2_USERNAME@$EC2_HOST " | ||
| cat > .env | ||
| pgrep java | xargs -r kill -15 # 기존에 실행 중인 Java 프로세스 종료 | ||
| sleep 10 | ||
| nohup java -jar /home/$EC2_USERNAME/BackEnd.jar > app.log 2>&1 & # 새 버전 애플리케이션 실행 | ||
| " | ||
| rm -f private_key.pem # 민감한 정보 삭제 | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| - 세션과 토큰의 차이는? | ||
|
|
||
| 세션 방식은 사용자의 정보를 서버가 저장함 | ||
|
|
||
| - 이용자 수가 많으면 서버 부하가 커짐(모든 사용자 정보를 테이블로 보유하고 있음) | ||
|
|
||
| 토큰 방식은 사용자가 내 정보가 포함된 토큰을 내밀기만 하면 됨 | ||
|
|
||
| - 서버의 부담이 적음. | ||
| - 다만 사용자의 정보를 저장하지 않기 때문에 할 수 없는 기능도 있음. | ||
|
|
||
| 세션 : 입장권인데 적혀있는 게 거의 없음. 사이트가 입장권 검사하고 저장해놓음. | ||
|
|
||
| 토큰 : 뭐가 많이 적혀있는 입장권. 사이트는 입장권 들고있으면 입장 허용해줌. | ||
|
|
||
| (참고자료) https://youtu.be/XXseiON9CV0?si=Am8JlSoLV0SiZX0W | ||
|
|
||
| - 엑세스 토큰과 리프레시 토큰이란? | ||
|
|
||
| 액세스 토큰 : 접근하기 위해 필요한 기본적인 토큰, 해킹 공격 방지를 위해 유효기간이 짧다. | ||
|
|
||
| 리프레쉬 토큰 : 만료된 액세스 토큰을 재생성해주는 토큰. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refresh Token을 “Access Token을 재생성해주는 토큰”으로만 설명하면 저장 위치, 만료 정책, 탈취 시 무효화 전략이 빠질 수 있습니다. 서버 저장 여부, 재발급 API 흐름, 회전 전략까지 함께 정리하는 것을 권장합니다. |
||
|
|
||
| - OAuth 1.0과 OAuth 2.0의 차이는? | ||
|
|
||
| OAuth 2.0 은 1.0과 달리 복잡한 암호화 서명 과정을 간소화하고, 웹/모바일 등 다양한 환경에 맞춘 인증 방식을 도입해 속도와 확장성을 대폭 개선한 버전 | ||
|
|
||
| 핵심 차이점 | ||
|
|
||
| | 구분 | OAuth 1.0 | OAuth 2.0 | | ||
| | --- | --- | --- | | ||
| | 핵심 매커니즘 | 모든 요청에 디지털 서명 필요 | 발급받은 액세스 토큰만으로 인증 | | ||
| | 암호화 요구사항 | HTTPS가 필수가 아님 | HTTPS(TLS) 필수 | | ||
| | 역할의 분리 | 단순함(Client, Server, User) | 인증서버와 리소스 서버의 분리 | | ||
| | 토큰 만료 | 토큰 만료 개념이 없거나 복잡 | 만료기간이 존재하며, 리프레시 토큰으로 갱신가능 | | ||
| | 지원 환경 | 웹 브라우저 기반 애플리케이션 중심 | 모바일 앱, Iot, 데스크톱 등 다양한 환경 지원 | | ||
|
|
||
|
|
||
| 왜 2.0으로 바뀌었을까? | ||
|
|
||
| 1. 개발의 복잡성 해결(디지털 서명의 폐지) | ||
|
|
||
| 1.0은 API를 호출할 때마다 복잡한 암호화 알고리즘으로 디지털 서명을 생성하고 이를 헤더에 담아 보내야 했음. 이 서명을 만드는 과정이 조금만 틀려도 인증이 실패했기 때문에 매우 불편했음. | ||
|
|
||
| 2.0은 이 서명 과정을 과감히 버렸음. 대신 HTTPS통신을 필수로 규정해 연결 자체를 암호화하고, 발급받은 문자열 토큰만 헤더에 얹어서 보내면 되도록 단순화 했음 | ||
|
|
||
| 2. 모바일 및 다양한 디바이스 지원 | ||
|
|
||
| OAuth 1.0이 나올 당시에는 웹브라우저 중심의 환경이었음. 하지만 모바일 앱, IoT 등의 기기들이 생기면서 브라우저가 없거나 화면이 없는 환경에서도 인증을 처리해야 할 필요가 생김. OAuth 2.0은 시나리오별 인증방식을 여러개 제공해 맞춤형 인증을 제공함 | ||
|
|
||
| 3. 대규모 서비스 분할(확장성) | ||
|
|
||
| OAuth 2.0은 인증을 담당하는 서버와 실제 데이터를 가지고 있는 서버의 역할을 명확히 나눴음. 덕분에 대기업이나 대규모 서비스에서는 인증서버만 따로 구축해 트래픽을 분산할 수 있음. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.gradle디렉터리는 로컬 Gradle 실행 캐시이므로 PR에 포함하지 않는 것을 권장합니다. 빌드 결과와 캐시는 환경마다 달라질 수 있어 리뷰 diff를 흐리고 충돌 가능성을 높이므로,.gitignore에.gradle/을 추가하고 이미 올라간 캐시 파일은 제거하는 것이 적절합니다.