Files
technical-visualization-haness/.work/keycloak-four-patterns/final/assets/ap1-browser-bearer-flow/ap1-browser-bearer-flow.alt.md
T
2026-07-29 18:03:21 +09:00

1.8 KiB
Raw Blame History

AP1 callback code에서 브라우저 Bearer 요청까지

Alternative text

브라우저 SPA, Keycloak, Resource Server 사이에서 authorization request, callback, token 교환, Bearer API 호출과 JSON 응답이 이어지는 순서도.

Long description

브라우저 SPA가 S256 code challenge가 포함된 authorization request를 Keycloak에 보낸다. Keycloak이 code와 state를 callback으로 돌려주면 SPA는 원래 verifier를 포함해 token endpoint에 code를 제출하고 access, refresh, ID token을 받는다. 이어서 SPA가 access token을 Authorization Bearer header에 넣어 Resource Server의 /api/me를 직접 호출하고 사용자 JSON을 받는다.

Elements and evidence

  • 브라우저 SPA (participant): PKCE transaction과 token set을 처리하고 access token으로 API 요청을 만드는 public client. Evidence: L201L236, L240L280, L303L322.
  • Keycloak (participant): Authorization code를 발급하고 code와 verifier를 token set으로 교환하는 authorization server. Evidence: L223L263.
  • Resource Server (participant): Bearer JWT의 signature, issuer, timestamp와 audience를 검증하고 사용자 JSON을 만드는 Spring API. Evidence: L311L353.

Relationships

  • 브라우저 SPA → Keycloak: authorization request · S256 challenge. Evidence: L223L236.
  • Keycloak → 브라우저 SPA: callback · code + state. Evidence: L240L250.
  • 브라우저 SPA → Keycloak: token request · code + verifier. Evidence: L250L261.
  • Keycloak → 브라우저 SPA: access + refresh + ID token. Evidence: L263L280.
  • 브라우저 SPA → Resource Server: GET /api/me · Bearer access token. Evidence: L303L322.
  • Resource Server → 브라우저 SPA: subject · username · issuer · audience. Evidence: L342L376.