forked from baron/baron-sso
2.2 KiB
2.2 KiB
#303 로그인 링크/코드 진입 실패 (/{locale}/l/{shortCode}) 대응
요약
- 로그인 링크 발송은 정상이나, 링크 클릭 후 로그인 검증 진입이 실패하는 사례가 있었습니다.
- 특히 locale prefix가 포함된 short-code 경로(
/{locale}/l/{shortCode})에서 재현되었습니다. - 원인은 라우터의 public path 판별과 short-code 추출 로직이 locale prefix 경로를 고려하지 못한 점이었습니다.
증상
- 링크 클릭 URL이
https://.../ko/l/AB123456형태일 때 로그인 검증이 자동 시작되지 않음 - 비로그인 상태에서 해당 경로 접근 시 signin으로 리다이렉트되어 short-code 검증이 끊김
원인
- Public path 판별에서
/l/경로가 제외되어 있었음 LoginScreen의 short-code 추출이uri.pathSegments.first == 'l'에만 의존/{locale}/l/{shortCode}에서는 첫 세그먼트가 locale이므로 추출 실패
조치 내용
- 경로 정책 분리
userfront/lib/features/auth/domain/login_link_route_policy.dart신규 추가- public path 판별(
isPublicAuthPath)과 short-code 추출(extractLoginShortCode)을 공용화
- 라우터 반영
userfront/lib/main.dartredirect에서isPublicAuthPath사용/l/경로를 public path로 허용
- 로그인 화면 반영
userfront/lib/features/auth/presentation/login_screen.dart에서extractLoginShortCode(Uri.base)로 short-code를 추출하도록 변경- locale prefix 유무와 관계없이 short-code 검증 진입 가능
테스트
재현 테스트 (Failing first)
flutter test test/login_link_route_policy_test.dart- 초기 실패 확인:
- localized short-code 추출 실패
- localized short-code public path 판별 실패
수정 후 회귀 테스트
flutter test test/login_link_route_policy_test.dart통과flutter test test/router_redirect_widget_test.dart통과
영향 범위
- 링크/코드 로그인 진입 라우팅 (
/l/{shortCode}및/{locale}/l/{shortCode}) - 기존
/verify,/signin,/login경로에는 동작 변화 없음
관련 이슈
- Gitea: #303
[bug][auth] 링크 클릭/코드 입력 로그인 실패 재현 및 수정