feat: add signed SPA account-linking helper

This commit is contained in:
donghyeon-ka
2026-07-25 16:38:01 +09:00
parent 32450c35ab
commit eec9feae5c
3 changed files with 81 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
# Account linking UX for the SPA
두 흐름을 구분한다.
- 로그인 도중 email collision: Keycloak의 안전한 First Broker Login flow가
기존 계정 인증을 요구한다.
- 로그인한 사용자가 설정 화면에서 “Google 연결”: Client-Initiated Account
Linking URL을 만들어 Keycloak로 redirect한다.
`createAccountLinkUrl`은 현재 token의 `session_state`, `azp`(issued-for),
provider와 nonce를 SHA-256 서명 재료로 사용한다. SPA는 연결 성공 후
Account Console 또는 별도 backend read model을 통해 연결 상태를 새로
조회해야 하며 email만 보고 “연결됨”을 표시하면 안 된다.
Unlink는 사용자가 다른 로그인 수단을 갖고 있는지 먼저 안내하고, Keycloak이
마지막 federated identity 제거를 거부하면 해당 오류를 그대로 성공처럼
처리하지 않는다. production First Broker Login에는 자동 기존-user linking을
넣지 않는다.