feature: 임시 로그인 추가#135
Conversation
|
Note
|
There was a problem hiding this comment.
Code Review
This pull request introduces a temporary login feature for development and testing environments (under 'local', 'dev', and 'test' profiles), allowing authentication with fixed credentials. It includes the controller, service, configuration properties, request DTO, and comprehensive acceptance and profile guard tests. Feedback on the changes suggests adding a null check for the expected credentials in DevAuthService to prevent a potential NullPointerException, and applying the profile restriction to DevLoginProperties to avoid registering it as a bean in production.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Test Results 97 files +2 97 suites +2 1m 2s ⏱️ -4s Results for commit 48aaa19. ± Comparison against base commit c3dd913. This pull request removes 15 and adds 21 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
| return MessageDigest.isEqual( | ||
| input.getBytes(StandardCharsets.UTF_8), | ||
| expected.getBytes(StandardCharsets.UTF_8) | ||
| ); |
There was a problem hiding this comment.
String.equals와 같이 단순 문자열 비교를 하지 않은 이유가 있나요?
| /** | ||
| * 개발용 임시 로그인이 운영 환경에 노출되지 않는지 검증한다. | ||
| * @Profile을 화이트리스트({"local","dev","test"})가 아닌 블랙리스트(!prod)로 바꾸는 사고를 막는 회귀 테스트다. | ||
| */ | ||
| @DisplayName("프로파일 가드: 개발용 임시 로그인") |
연관된 이슈
변경 사항
POST /auth/login/dev개발용 임시 로그인 API를 추가했습니다.AuthService.submitOnboarding)을 재사용해 온보딩이 완료된 상태로 만듭니다.MessageDigest.isEqual)로 구현했습니다.auth.dev-login.login-id,auth.dev-login.password,auth.dev-login.nickname을 추가하고 환경별 설정을 구성했습니다.@Profile({"local", "dev", "test"})로 제한해 운영(prod) 환경에는 등록되지 않도록 격리했습니다.작업 내용
API
POST /auth/login/dev설정 파일에 지정된 고정 아이디/비밀번호로 로그인합니다. 카카오 로그인과 동일하게 Forgather access token과 refresh token을 응답 바디와 HttpOnly 쿠키로 함께 반환합니다.
로컬·개발·테스트 프로파일에서만 등록되며, 운영 환경에는 이 엔드포인트가 존재하지 않습니다.
[요청]
loginIdpassword[요청 예시]
{ "loginId": "your-dev-login-id", "password": "your-dev-login-password" }[응답]
[응답 예시 - 200]
{ "code": "SUCCESS", "message": null, "data": { "accessToken": "forgather-access-token", "refreshToken": "forgather-refresh-token" } }[응답 쿠키]
access_token/refresh_token/auth/refresh기존 카카오 로그인 및 토큰 재발급 API와 동일한
AuthCookieProvider정책(secure/SameSite/만료 시간)을 적용합니다. 쿠키 만료 시간은 각 토큰의 잔여 만료 시간으로 설정합니다.크리덴셜 검증
[인증 기준]
설정된
auth.dev-login.login-id,auth.dev-login.password와 요청 값이 모두 일치할 때만 로그인에 성공합니다. 하나라도 불일치하면UnauthorizedException으로 401을 반환합니다.[상수 시간 비교]
아이디·비밀번호 비교는
MessageDigest.isEqual을 사용해 상수 시간으로 수행합니다. 문자열 조기 반환 비교에서 발생할 수 있는 타이밍 사이드채널을 피하기 위함입니다.[평문 비밀번호 로깅 방지]
LoggingAspect가 서비스 메서드 파라미터를toString()으로 로깅하므로,DevLoginRequest.toString()을 재정의해 비밀번호를***로 마스킹합니다. 이 재정의를 제거하면 평문 비밀번호가app.log에 남습니다.회원 처리
[신규 회원]
설정된
login-id에 연결된 임시 계정이 없으면 다음을 수행합니다.login-id를 식별자로 하는KakaoHost를 생성합니다.Host.name은 설정된auth.dev-login.nickname으로 저장합니다.AuthService.submitOnboarding)을 그대로 재사용해 필수 약관에 동의하고 온보딩을 완료 처리합니다.실제 온보딩 경로를 재사용하므로 임시 로그인 계정과 실제 계정의 상태가 갈라지지 않습니다.
[기존 회원]
이미 생성된 임시 계정은
login-id로 조회해 재사용하며, 로그인 시마다 계정 정보를 갱신하거나 약관 동의 이력을 중복 저장하지 않습니다.[Forgather 토큰]
회원 확인 또는 생성이 완료되면 Forgather access token과 refresh token을 발급해 기존
LoginResponse응답 바디와 HttpOnly 쿠키에 함께 담아 반환합니다.임시 로그인이 사용되면 경고 로그(
개발용 임시 로그인이 사용되었습니다.)를 남깁니다.운영 환경 격리 (프로파일)
임시 로그인 관련 컴포넌트를
local,dev,test프로파일에서만 등록되도록 제한했습니다.DevAuthController— 엔드포인트 자체가 운영 환경에 매핑되지 않습니다.DevAuthService— 인증·회원 처리 빈이 운영 환경에 등록되지 않습니다.DevLoginProperties— 설정 프로퍼티 빈이 운영 환경에 등록되지 않습니다. (@ConfigurationPropertiesScan으로 스캔되므로 프로퍼티 클래스에 붙인@Profile이 그대로 적용됩니다.)세 컴포넌트가 동일한
{"local", "dev", "test"}프로파일 집합으로 함께 등록·제외되며, 운영 환경에서는 임시 로그인 진입 경로가 존재하지 않습니다.설정
[auth.dev-login]
환경별 설정에 임시 로그인 값을 추가했습니다.
auth.dev-login.login-id— 임시 로그인 아이디auth.dev-login.password— 임시 로그인 비밀번호auth.dev-login.nickname— 최초 생성 시 사용할 닉네임로컬(
application.yml), 개발 서버(application-dev.yml), 테스트(src/test/resources/application.yml) 프로파일에 각각 값을 구성했습니다. 실제 크리덴셜 값은 git-crypt로 암호화된 설정 파일에서 관리하며, 본 문서에는 예시 placeholder로 대체했습니다.테스트
[프로파일 가드 회귀 테스트]
DevAuthProfileGuardTest—prod프로파일에서는DevAuthController,DevAuthService빈이 등록되지 않음을 검증합니다. 화이트리스트({"local","dev","test"})를 블랙리스트(!prod)로 바꾸는 등의 사고로 운영 환경에 임시 로그인이 노출되는 회귀를 막습니다.[인수 테스트]
DevAuthAcceptanceTest—test프로파일 전체 컨텍스트에서 로그인 엔드포인트를 검증합니다.제외 범위
Summary by CodeRabbit