# AP4 edge forward-auth with Google federation Google federation은 AP4의 edge contract를 바꾸지 않는다. ```text Browser -> nginx -> oauth2-proxy -> Keycloak -> Google Browser <- AP4_SESSION <- oauth2-proxy <- Keycloak nginx -> trusted identity headers -> upstream app ``` oauth2-proxy가 신뢰하는 issuer는 Google이 아니라 Keycloak이다. Google ID token은 Keycloak broker 경계 안에서 검증되고, oauth2-proxy는 Keycloak authorization code/token과 session cookie만 다룬다. upstream 앱도 broker 여부와 무관하게 동일한 trusted headers를 받는다. `verify-edge-google-federation.sh`는 mock Google 로그인, confidential server-side token 교환(브라우저에 token 요청 없음), 미검증 broker email 거부, Keycloak email verification 완료 후 HttpOnly edge cookie와 brokered subject/email header를 실제 컨테이너와 브라우저로 검증한다. minimal session의 `X-Auth-Request-User`는 표시용 username이 아니라 Keycloak의 안정적인 local subject UUID이며, 화면 이름이 필요하면 별도 허용 header를 명시한다. brokered token/claims가 client-side session cookie의 4KB 한계를 넘지 않도록 oauth2-proxy에는 `session-cookie-minimal=true`를 적용한다. AP4 upstream은 token forwarding이 아니라 trusted identity headers만 사용하므로 cookie에 access/refresh/ID token을 보관할 필요가 없다.