Files
document-haness/docs/keycloak-session-store/source/docs/evidence/b2-multi-instance-session
DongHyeonkaandClaude Opus 5 b2963105a8 docs(keycloak-session-store): import the session-storage lab as a new project
The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.

Follows the import procedure in README.md.

  source/     the originating repository verbatim — 78 documents, 28 SVGs,
              8 manifests, plus .source-revision recording the commit
  final/      the SSOT
    document.md   729 lines written from the 29 experiment documents, not
                  concatenated: what was predicted, what was measured, and
                  where the measurement itself was wrong
    evidence/raw    125 outputs, flattened to <experiment>__<file> because
                    the originals collided (01-baseline.txt appeared three
                    times) and the audit only globs the top level
    evidence/meta   one per raw file; command and exitCode are null and the
                    README says why rather than inventing them
    evidence/browser  22 captures
    assets/       three diagrams through techviz
    .techviz/     their VizSpecs

A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.

Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.

verify-pipeline.py passes. audit-records.py reports no issues.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 22:51:59 +09:00
..

B-2 — 다중 인스턴스 운영 증거

2026-09-04 15:0515:15 KST 해설: docs/experiment-b2-multi-instance-session.md

파일 무엇을 보여주는가
01-jdbc-store-deploy.txt JDBC 저장소로 배포. 테이블이 조용히 안 만들어졌다
02-schema.txt 원인 — 기본 DDL 은 blob(PostgreSQL 에 없음), -postgres.sql 판본이 따로 있다. PRIMARY KEY (client_registration_id, principal_name) — 조회 키 문제가 DDL 에 박혀 있다
03-plaintext-tokens.txt Q3 검증 2번bytea 안이 JWT 문자열 그대로. 디코드하면 {"alg":"HS512",...}
04-overwrite-test.txt Q1 검증 3번 — 같은 사용자 재로그인 시 행 수 1 그대로, issued_at 과 md5 만 바뀜 = UPDATE(덮어쓰기)
05-logout-cleanup.txt Q1 검증 4번 — Redis 0키 / PostgreSQL 1행 잔존 / Keycloak SSO 2세션 잔존
b2-before-relogin.png JDBC 전환 직후, 옛 세션은 여전히 false
b2-tokens-shared-across-instances.png 재로그인 후 accessTokenStoredOnServer: true — 두 replica 에서 동작

핵심 네 줄

  1. 세션 Redis + 토큰 PostgreSQL 분리 저장이 성립한다. B-1 의 "로그인은 됐는데 토큰이 없는" 상태가 해결됐다.
  2. refresh token 은 평문이다. DB 읽기 권한이면 작동하는 토큰을 얻는다.
  3. 같은 사용자의 두 번째 로그인이 첫 번째를 덮어쓴다. 기본키에 session id 가 없어 구조적으로 그렇다.
  4. 로그아웃은 셋 중 하나만 지운다. 평문 토큰과 Keycloak SSO 세션이 남는다.

스크린샷 주의

b2-tokens-shared-across-instances.pngB-0 의 b0-bff-token-boundary.png 와 동일 파일이다 (md5 9ed00537…). 두 시점 모두 accessTokenStoredOnServer: true 인 같은 화면이라 바이트가 같다.

그래서 이 png 는 "JDBC 전환으로 토큰이 공유된다" 를 단독으로 증명하지 못한다. 그 증명은 01-jdbc-store-deploy.txt(테이블 생성)과 03-plaintext-tokens.txt(행에 토큰이 들어 있음)가 한다. b2-before-relogin.png 는 B-1 의 캡처와 동일 파일이다.