# AP2 server-held token에서 브라우저 Bearer 요청까지 ## Alternative text 브라우저, Spring mediator, authorized-client store, Resource Server 사이에서 AP2_SESSION 요청, access-only 응답, 브라우저 Bearer 호출과 JSON 응답이 이어지는 순서도. ## Long description 브라우저가 AP2_SESSION cookie와 함께 /token/access를 Spring mediator에 요청한다. Mediator는 현재 principal과 keycloak registration으로 authorized-client store에서 token을 조회하고 access token, type, expiry만 응답한다. 브라우저는 access token을 지역 변수로 받아 Authorization Bearer header를 만들고 Resource Server의 /api/me를 직접 호출한 뒤 사용자 JSON을 받는다. Refresh token은 브라우저 응답에 포함되지 않는다. ## Elements and evidence - **브라우저** (participant): AP2_SESSION으로 access endpoint를 호출하고 반환된 access token으로 Resource Server를 직접 호출한다. Evidence: L505–L511, L558–L586. - **Spring mediator** (participant): 현재 principal로 authorized client를 조회하고 access token, type, expiry만 JSON으로 반환한다. Evidence: L503–L540. - **Authorized-client store** (participant): Registration과 principal name으로 access token과 refresh token을 보관하는 process-local service. Evidence: L445–L457, L513–L521. - **Resource Server** (participant): 브라우저가 만든 Bearer JWT를 검증하고 /api/me 사용자 JSON을 반환한다. Evidence: L571–L599. ## Relationships - **브라우저 → Spring mediator:** GET /token/access + AP2_SESSION. Evidence: L503–L511. - **Spring mediator → Authorized-client store:** authorize current principal. Evidence: L513–L521. - **Authorized-client store → Spring mediator:** current access token. Evidence: L513–L521. - **Spring mediator → 브라우저:** access token + type + expiry. Evidence: L523–L540. - **브라우저 → Resource Server:** GET /api/me · browser-created Bearer. Evidence: L558–L588. - **Resource Server → 브라우저:** subject · username · issuer · audience. Evidence: L590–L615.