Skip to content

[feat] 로그인/로그아웃 시 hasSession 쿠키 설정/삭제#117

Merged
nYeonG4001 merged 3 commits intodevelopV2from
auto/feature/hassession-cookie
Apr 12, 2026
Merged

[feat] 로그인/로그아웃 시 hasSession 쿠키 설정/삭제#117
nYeonG4001 merged 3 commits intodevelopV2from
auto/feature/hassession-cookie

Conversation

@nYeonG4001
Copy link
Copy Markdown
Collaborator

Summary

  • 로그인(이메일/소셜/복구) 성공 시 hasSession=true 쿠키 Set-Cookie
  • 로그아웃 시 hasSession 쿠키 삭제(maxAge=0)
  • httpOnly=false, SameSite=Lax, path=/ — JS에서 읽을 수 있는 세션 힌트 쿠키
  • 프론트 AuthInitializer에서 이 쿠키 유무로 /auth/refresh 호출 여부 판단 가능

변경 파일

  • AuthController.javaHAS_SESSION_COOKIE 상수 + setHasSessionCookie / clearHasSessionCookie 헬퍼 추가, 5개 엔드포인트에 적용
  • AuthControllerTest.java — 로그인/소셜 로그인/복구/로그아웃 쿠키 검증 케이스 추가

Test plan

  • ./gradlew test --tests "com.devpick.domain.user.controller.AuthControllerTest" 통과
  • 로그인 성공 시 hasSession=true; SameSite=Lax 쿠키 포함 검증
  • 로그아웃 시 refreshToken, hasSession 모두 Max-Age=0 검증

- 로그인 성공(이메일/소셜/복구) → hasSession=true 쿠키 설정
- 로그아웃 → hasSession 쿠키 삭제(maxAge=0)
- httpOnly=false, SameSite=Lax, path=/ — JS에서 읽을 수 있는 세션 힌트 쿠키
- 프론트에서 이 쿠키 유무로 /auth/refresh 호출 여부 판단
- 로그인/소셜 로그인/복구 성공 시 hasSession=true(SameSite=Lax) 쿠키 검증
- 로그아웃 시 refreshToken, hasSession 모두 Max-Age=0 검증
- multiple Set-Cookie 헤더 검증 방식을 람다 + Hamcrest hasItem으로 구현
@nYeonG4001 nYeonG4001 changed the title feat: 로그인/로그아웃 시 hasSession 쿠키 설정/삭제 [feat] 로그인/로그아웃 시 hasSession 쿠키 설정/삭제 Apr 12, 2026
- "Set-Cookie" 리터럴 상수화(SET_COOKIE_HEADER) — 중복 리터럴 4회 제거
- httpOnly(false) 라인에 NOSONAR java:S2092 주석 추가 — JS 세션 힌트 쿠키 의도적 설계
@sonarqubecloud
Copy link
Copy Markdown

@nYeonG4001 nYeonG4001 merged commit 677fdc9 into developV2 Apr 12, 2026
3 checks passed
@nYeonG4001 nYeonG4001 deleted the auto/feature/hassession-cookie branch April 12, 2026 01: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.

1 participant