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

Feat/Implement 42oauth login #10

Merged
merged 6 commits into from
Aug 5, 2024
Merged

Feat/Implement 42oauth login #10

merged 6 commits into from
Aug 5, 2024

Conversation

seungwonme
Copy link
Member

@seungwonme seungwonme commented Aug 4, 2024

주요 구현 사항

  • backend, frontend 폴더 뎁스를 줄였습니다. 그에 따라서 빌드 시 실행하는 스크립트 파일이 수정되었습니다.
  • run_backend.sh, run_frontend 스크립트에서 불필요한 명령어를 실행시키지 않도록 수정했습니다.
  • db 초기화를 위한 clean_db 스크립트를 만들었습니다.
  • 42OAuth와 JWT, cookie를 이용하여 로그인 구현을 했습니다.
    • feat: Create views for 42OAuth Login #9 재희님이 구현하신 42OAuth 로직을 그대로 썼고 해당 데이터 중 일부를 JWT 토큰에 넣어서 cookie에 저장했습니다.
    • http://localhost:8000/api/validate api 호출을 통해 유효한 JWT 토큰인지 판단이 가능합니다.
  • User 모델에 2FA를 위한 email 필드를 추가했습니다.

리뷰어 참고 사항

  • jwt 토큰 발행시 5173 포트로 리다이렉트를 하기 때문에 docker-compose를 이용한 실행(make)은 정상적이지 않습니다. (80번으로 리다이렉트하면 정상적으로 동작하는 것 확인함)
  • Differences Between Cookies, Sessions and Tokens 이 영상보면 쿠키, 세션, 토큰 이해 쌉가넝
    • 쿠키: 옮기는 매개체, 역할은 서버가 뭘 담느냐에 따라 달라짐, 브라우저에 저장되며 요청 시 자동으로 요청에 포함됨
    • 토큰: 서버가 기억하고 있는 텍스트, JWT는 토큰의 한 종류이며 JWT 안에 들어있는 값은 누구나 볼 수 있으나 서버가 기억하는 키를 이용해서 JWT가 유효한지 확인이 가능 (DB없이 검증가능)
    • 세션: 서버에서 별도의 세션 DB를 두고 로그인 성공 시 세션 DB에 유저 저장 후 세션 ID를 쿠키로 브라우저에 보냄.
    • 결론: 쿠키는 그저 매개체이며 인증은 토큰과 세션을 통해서 할 수 있다.

@seungwonme seungwonme changed the title Feat/42oauth login Feat/Implement 42oauth login Aug 4, 2024
@seonjo1
Copy link
Contributor

seonjo1 commented Aug 5, 2024

nginx를 포함해서 돌리니까 안돌아가요 ㅠㅠ

@seonjo1
Copy link
Contributor

seonjo1 commented Aug 5, 2024

nginx를 포함해서 돌리니까 안돌아가요 ㅠㅠ

되네요!

@seonjo1 seonjo1 merged commit 7d08282 into main Aug 5, 2024
@seonjo1 seonjo1 deleted the feat/42oauth-login branch August 13, 2024 09:19
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.

2 participants