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>
This commit is contained in:
DongHyeonka
2026-09-04 22:51:59 +09:00
co-authored by Claude Opus 5
parent 43bccd08a8
commit b2963105a8
5017 changed files with 372751 additions and 4943 deletions
@@ -0,0 +1,24 @@
# BFF 가 저장하는 두 가지와 그 조회 키
## Alternative text
세션 id 로 찾는 Application Session 과 principal 이름으로 찾는 OAuth2AuthorizedClient 가 각각 다른 저장소에 놓인 구성.
## Long description
Spring Security 의 자동 구성은 세션을 서블릿 컨테이너 메모리에, authorized client 를 InMemoryOAuth2AuthorizedClientService 에 둔다. 조회 경로가 다른데 이름이 비슷해 하나로 오해하기 쉽다. AuthenticatedPrincipalOAuth2AuthorizedClientRepository 는 principal 이름으로 찾고 조회 키에 session id 가 없다. 그래서 SPRING_SESSION_STORE_TYPE 을 redis 로 바꿔 세션을 옮겨도 토큰은 인스턴스 메모리에 남는다.
## Elements and evidence
- **브라우저 요청** (actor): 쿠키에 세션 id 를 담아 온다. Evidence: L326L331.
- **Application Session** (component): 누가 로그인했는지를 담는다. 세션 id 로 찾는다. Evidence: L335L341.
- **OAuth2AuthorizedClient** (component): access · refresh token 을 담는다. principal 이름으로 찾는다. Evidence: L335L341.
- **Redis** (datastore): 세션을 옮긴 곳. B-1 에서 여기까지는 옮겨졌다. Evidence: L347L351.
- **PostgreSQL** (datastore): 토큰을 옮긴 곳. B-2 에서 따로 옮겨야 했다. Evidence: L355L358.
## Relationships
- **OAuth2AuthorizedClient → PostgreSQL:** 저장. Evidence: L355L358.
- **브라우저 요청 → OAuth2AuthorizedClient:** principal 이름으로 조회. Evidence: L332L341.
- **브라우저 요청 → Application Session:** 세션 id 로 조회. Evidence: L326L331.
- **Application Session → Redis:** 저장. Evidence: L347L351.
@@ -0,0 +1,22 @@
# BFF 가 저장하는 두 가지와 그 조회 키
# Question: 세션 저장소를 Redis 로 옮기면 토큰도 같이 옮겨지는가
direction: right
n0: "브라우저 요청" {
shape: person
}
n1: "Application Session" {
shape: rectangle
}
n2: "OAuth2AuthorizedClient" {
shape: rectangle
}
n3: "Redis" {
shape: cylinder
}
n4: "PostgreSQL" {
shape: cylinder
}
n0 -> n1: "세션 id 로 조회"
n0 -> n2: "principal 이름으로 조회"
n1 -> n3: "저장"
n2 -> n4: "저장"
@@ -0,0 +1,14 @@
digraph techviz {
graph [rankdir=LR, splines=ortho, nodesep=0.55, ranksep=0.85];
node [fontname=Helvetica, fontsize=11, margin="0.18,0.12", style="rounded,filled", fillcolor=white, color="#2d4357", penwidth=1.5];
edge [fontname=Helvetica, fontsize=10, color="#364b5f", penwidth=1.4, arrowsize=0.75];
n0 [label="브라우저 요청", shape=box, style="rounded,dashed,filled"];
n1 [label="Application Session", shape=box, style="rounded,filled"];
n2 [label="OAuth2AuthorizedClient", shape=box, style="rounded,filled"];
n3 [label="Redis", shape=cylinder, style="rounded,filled"];
n4 [label="PostgreSQL", shape=cylinder, style="rounded,filled"];
n0 -> n1 [label="세션 id 로 조회", style=solid];
n0 -> n2 [label="principal 이름으로 조회", style=solid];
n1 -> n3 [label="저장", style=solid];
n2 -> n4 [label="저장", style=solid];
}
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2026-07-23T00:00:00.000Z" agent="techviz-harness" version="24.7.17" type="device">
<diagram id="bff-store-lookup-keys" name="BFF 가 저장하는 두 가지와 그 조회 키">
<mxGraphModel dx="1038" dy="371" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1038" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="n_request" value="브라우저 요청&lt;br/&gt;JSESSIONID" tooltip="쿠키에 세션 id 를 담아 온다. | Evidence: L326-L331" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;dashed=1;fillColor=#f5f7fa;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="70.0" y="151.0" width="150.0" height="84.0" as="geometry"/>
</mxCell>
<mxCell id="n_app-session" value="Application Session&lt;br/&gt;조회 키: 세션 id" tooltip="누가 로그인했는지를 담는다. 세션 id 로 찾는다. | Evidence: L335-L341" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="390.5" y="86.0" width="167.0" height="71.0" as="geometry"/>
</mxCell>
<mxCell id="n_authorized-client" value="OAuth2AuthorizedClient&lt;br/&gt;조회 키: principal 이름" tooltip="access · refresh token 을 담는다. principal 이름으로 찾는다. | Evidence: L335-L341" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;strokeColor=#d97706;fillColor=#fffdf5;" vertex="1" parent="1">
<mxGeometry x="380.0" y="229.0" width="188.0" height="71.0" as="geometry"/>
</mxCell>
<mxCell id="n_redis" value="Redis&lt;br/&gt;SPRING_SESSION_STORE_TYPE=redis" tooltip="세션을 옮긴 곳. B-1 에서 여기까지는 옮겨졌다. | Evidence: L347-L351" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;shape=cylinder3;boundedLbl=1;backgroundOutline=1;fillColor=#eef6fb;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="735.0" y="60.0" width="251.0" height="97.0" as="geometry"/>
</mxCell>
<mxCell id="n_postgres" value="PostgreSQL&lt;br/&gt;JdbcOAuth2AuthorizedClientService" tooltip="토큰을 옮긴 곳. B-2 에서 따로 옮겨야 했다. | Evidence: L355-L358" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;shape=cylinder3;boundedLbl=1;backgroundOutline=1;fillColor=#eef6fb;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="728.0" y="229.0" width="265.0" height="97.0" as="geometry"/>
</mxCell>
<mxCell id="e_client-store" value="저장" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_authorized-client" target="n_postgres">
<mxGeometry relative="1" as="geometry">
<mxPoint x="672.0" y="271.0" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_lookup-client" value="principal 이름으로 조회" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_request" target="n_authorized-client">
<mxGeometry relative="1" as="geometry">
<mxPoint x="324.0" y="233.2" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_lookup-session" value="세션 id 로 조회" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_request" target="n_app-session">
<mxGeometry relative="1" as="geometry">
<mxPoint x="329.2" y="152.8" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_session-store" value="저장" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_app-session" target="n_redis">
<mxGeometry relative="1" as="geometry">
<mxPoint x="670.2" y="115.0" as="offset"/>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,754 @@
{
"type": "excalidraw",
"version": 2,
"source": "techviz-harness",
"elements": [
{
"id": "edge-client-store",
"type": "arrow",
"x": 568.0,
"y": 264.5,
"width": 160.0,
"height": 13.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 376014802,
"version": 1,
"versionNonce": 705557696,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
0.0
],
[
80.0,
0.0
],
[
80.0,
13.0
],
[
160.0,
13.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-authorized-client",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-postgres",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-client-store",
"type": "text",
"x": 627.0,
"y": 259.0,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1256161226,
"version": 1,
"versionNonce": 1896155258,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "저장",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "저장",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-lookup-client",
"type": "arrow",
"x": 220.0,
"y": 202.0,
"width": 160.0,
"height": 62.5,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 1699394798,
"version": 1,
"versionNonce": 79091282,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
0.0
],
[
80.0,
0.0
],
[
80.0,
62.5
],
[
160.0,
62.5
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-request",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-authorized-client",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-lookup-client",
"type": "text",
"x": 256.0,
"y": 221.25,
"width": 136,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1504789250,
"version": 1,
"versionNonce": 806223247,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "principal 이름으로 조회",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "principal 이름으로 조회",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-lookup-session",
"type": "arrow",
"x": 220.0,
"y": 121.5,
"width": 170.5,
"height": 62.5,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 228157207,
"version": 1,
"versionNonce": 1803550816,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
62.5
],
[
85.25,
62.5
],
[
85.25,
0.0
],
[
170.5,
0.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-request",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-app-session",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-lookup-session",
"type": "text",
"x": 284.25,
"y": 140.75,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1022718620,
"version": 1,
"versionNonce": 1009213693,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "세션 id 로 조회",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "세션 id 로 조회",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-session-store",
"type": "arrow",
"x": 557.5,
"y": 108.5,
"width": 177.5,
"height": 13.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 1420190934,
"version": 1,
"versionNonce": 759421815,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
13.0
],
[
88.75,
13.0
],
[
88.75,
0.0
],
[
177.5,
0.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-app-session",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-redis",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-session-store",
"type": "text",
"x": 625.25,
"y": 103.0,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1018479709,
"version": 1,
"versionNonce": 1687570089,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "저장",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "저장",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-request",
"type": "rectangle",
"x": 70.0,
"y": 151.0,
"width": 150.0,
"height": 84.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 383223514,
"version": 1,
"versionNonce": 417388610,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-request",
"type": "text",
"x": 80.0,
"y": 161.0,
"width": 130.0,
"height": 64.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1089093729,
"version": 1,
"versionNonce": 909637075,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "브라우저 요청\nJSESSIONID",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "브라우저 요청\nJSESSIONID",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-app-session",
"type": "rectangle",
"x": 390.5,
"y": 86.0,
"width": 167.0,
"height": 71.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1710553737,
"version": 1,
"versionNonce": 1839332537,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-app-session",
"type": "text",
"x": 400.5,
"y": 96.0,
"width": 147.0,
"height": 51.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 573778378,
"version": 1,
"versionNonce": 1579160282,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "Application Session\n조회 키: 세션 id",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "Application Session\n조회 키: 세션 id",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-authorized-client",
"type": "rectangle",
"x": 380.0,
"y": 229.0,
"width": 188.0,
"height": 71.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 531288634,
"version": 1,
"versionNonce": 301523243,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-authorized-client",
"type": "text",
"x": 390.0,
"y": 239.0,
"width": 168.0,
"height": 51.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 75370592,
"version": 1,
"versionNonce": 980967547,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "OAuth2AuthorizedClient\n조회 키: principal 이름",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "OAuth2AuthorizedClient\n조회 키: principal 이름",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-redis",
"type": "rectangle",
"x": 735.0,
"y": 60.0,
"width": 251.0,
"height": 97.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#e7f5ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 518178690,
"version": 1,
"versionNonce": 1422748266,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-redis",
"type": "text",
"x": 745.0,
"y": 70.0,
"width": 231.0,
"height": 77.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1745522512,
"version": 1,
"versionNonce": 1421486581,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "Redis\nSPRING_SESSION_STORE_TYPE=redis",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "Redis\nSPRING_SESSION_STORE_TYPE=redis",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-postgres",
"type": "rectangle",
"x": 728.0,
"y": 229.0,
"width": 265.0,
"height": 97.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#e7f5ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1035759464,
"version": 1,
"versionNonce": 1511157596,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-postgres",
"type": "text",
"x": 738.0,
"y": 239.0,
"width": 245.0,
"height": 77.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1404040862,
"version": 1,
"versionNonce": 1598470501,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "PostgreSQL\nJdbcOAuth2AuthorizedClientService",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "PostgreSQL\nJdbcOAuth2AuthorizedClientService",
"autoResize": true,
"lineHeight": 1.25
}
],
"appState": {
"gridSize": 10,
"viewBackgroundColor": "#ffffff",
"currentItemFontFamily": 5
},
"files": {}
}
@@ -0,0 +1,32 @@
{
"harness_version": "0.2.0",
"spec_id": "bff-store-lookup-keys",
"spec_version": "1.1",
"spec_sha256": "43dcbb2dd166f749010bbc6c21cbd6765d700d103672a9a836c18a77c5dbf1ea",
"source_context": {
"document": "docs/keycloak-session-store/final/document.md",
"document_sha256": "609353e10bfd37a9bbb6a79ecf2a32f3d3c02d5d161879a14ad4713e49e7e5e8",
"anchor": {
"kind": "heading",
"value": "B-1 · 세션만 Redis 로 옮기면 — 반쪽만 옮겨진다",
"line": 345
}
},
"outputs": [
"bff-store-lookup-keys.svg",
"bff-store-lookup-keys.mmd",
"bff-store-lookup-keys.d2",
"bff-store-lookup-keys.dot",
"bff-store-lookup-keys.drawio",
"bff-store-lookup-keys.excalidraw",
"bff-store-lookup-keys.alt.md"
],
"lint_issue_count": 0,
"assumption_count": 0,
"assumptions_allowed": false,
"composition_profile": "component-flow",
"reference_ids": [
"payment-event-flow"
],
"diagram_only": true
}
@@ -0,0 +1,14 @@
%% BFF 가 저장하는 두 가지와 그 조회 키
%% question: 세션 저장소를 Redis 로 옮기면 토큰도 같이 옮겨지는가
flowchart LR
n0(["브라우저 요청"])
n1["Application Session"]
n2["OAuth2AuthorizedClient"]
n3[("Redis")]
n4[("PostgreSQL")]
n0 -->|"세션 id 로 조회"| n1
n0 -->|"principal 이름으로 조회"| n2
n1 -->|"저장"| n3
n2 -->|"저장"| n4
classDef external stroke-dasharray: 6 4
class n0 external
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="1038" height="371" viewBox="0 0 1038 371" role="img" aria-labelledby="diagram-title diagram-description">
<title id="diagram-title">BFF 가 저장하는 두 가지와 그 조회 키</title>
<desc id="diagram-description">Spring Security 의 자동 구성은 세션을 서블릿 컨테이너 메모리에, authorized client 를 InMemoryOAuth2AuthorizedClientService 에 둔다. 조회 경로가 다른데 이름이 비슷해 하나로 오해하기 쉽다. AuthenticatedPrincipalOAuth2AuthorizedClientRepository 는 principal 이름으로 찾고 조회 키에 session id 가 없다. 그래서 SPRING_SESSION_STORE_TYPE 을 redis 로 바꿔 세션을 옮겨도 토큰은 인스턴스 메모리에 남는다.</desc>
<metadata>{&quot;techviz&quot;:{&quot;spec_version&quot;:&quot;1.1&quot;,&quot;id&quot;:&quot;bff-store-lookup-keys&quot;,&quot;profile&quot;:&quot;component-flow&quot;},&quot;source_context&quot;:{&quot;document&quot;:&quot;docs/keycloak-session-store/final/document.md&quot;,&quot;document_sha256&quot;:&quot;609353e10bfd37a9bbb6a79ecf2a32f3d3c02d5d161879a14ad4713e49e7e5e8&quot;,&quot;anchor&quot;:{&quot;kind&quot;:&quot;heading&quot;,&quot;value&quot;:&quot;B-1 · 세션만 Redis 로 옮기면 — 반쪽만 옮겨진다&quot;,&quot;line&quot;:345}},&quot;evidence_policy&quot;:&quot;Each factual element cites source lines or is marked assumption.&quot;,&quot;diagram_only&quot;:true}</metadata>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" />
</marker>
<style>
:root { color-scheme: light; }
text { font-family: Inter, Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: #111827; }
.canvas { fill: #ffffff; }
.group-box { fill: #ffffff; stroke: #9ca3af; stroke-width: 1.4; stroke-dasharray: 7 5; }
.group-label-bg { fill: #ffffff; }
.group-label { font-size: 13px; font-weight: 650; fill: #374151; }
.edge { fill: none; stroke: #374151; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; marker-end: url(#arrow); }
.edge.style-dashed, .edge.semantic-dashed, .edge.assumption { stroke-dasharray: 7 5; }
.edge.style-dotted { stroke-dasharray: 2 5; }
.edge.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
.edge.emphasis-muted { stroke: #9ca3af; }
.edge.emphasis-warning, .edge.kind-failure, .edge.kind-error { stroke: #dc2626; stroke-width: 2.2; }
.edge-label-bg { fill: #ffffff; }
.edge-label { font-size: 12px; font-weight: 560; text-anchor: middle; }
.node-shape { fill: #ffffff; stroke: #4b5563; stroke-width: 1.7; }
.node-shape.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
.node-shape.emphasis-muted { stroke: #9ca3af; fill: #f9fafb; }
.node-shape.emphasis-warning { stroke: #d97706; stroke-width: 2; fill: #fffdf5; }
.node-shape.kind-database, .node-shape.kind-datastore, .node-shape.kind-storage { fill: #f8fafc; }
.node-shape.kind-queue, .node-shape.kind-event, .node-shape.kind-topic { fill: #fafafa; }
.node-shape.assumption { stroke-dasharray: 4 4; }
.storage-bottom, .controller-divider { fill: none; stroke: #4b5563; stroke-width: 1.4; }
.controller-led { fill: #4b5563; }
.actor-symbol { fill: none; stroke: #4b5563; stroke-width: 1.8; stroke-linecap: round; }
.actor-symbol.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
.node-label { font-size: 14px; font-weight: 650; text-anchor: middle; }
.node-role { font-size: 10px; letter-spacing: 0.04em; text-anchor: middle; fill: #6b7280; }
.node-detail-divider { stroke: #d1d5db; stroke-width: 1; }
.node-detail { font-size: 11px; fill: #374151; }
.assumption-badge { font-size: 9px; font-weight: 700; fill: #92400e; }
.failure-mark { stroke: #dc2626; stroke-width: 4; stroke-linecap: round; }
.lifeline { stroke: #9ca3af; stroke-width: 1.2; stroke-dasharray: 5 5; }
.timeline-axis { stroke: #374151; stroke-width: 1.8; marker-end: url(#arrow); }
.timeline-stem { stroke: #6b7280; stroke-width: 1.3; }
.timeline-marker { fill: #ffffff; stroke: #374151; stroke-width: 1.7; }
.timeline-marker.primary { fill: #2563eb; stroke: #2563eb; }
.timeline-marker.warning { fill: #dc2626; stroke: #dc2626; }
.timeline-label { font-size: 13px; font-weight: 650; text-anchor: middle; }
.timeline-detail { font-size: 11px; fill: #4b5563; text-anchor: middle; }
</style>
</defs>
<rect class="canvas" width="1038" height="371" />
<polyline class="edge kind-write style-solid emphasis-normal" points="568.0,264.5 648.0,264.5 648.0,277.5 728.0,277.5" data-evidence="355-358" />
<rect class="edge-label-bg" x="650.0" y="257.0" width="44.0" height="22" rx="3" />
<text class="edge-label" x="672.0" y="272.0">저장</text>
<polyline class="edge kind-read style-solid emphasis-normal" points="220.0,202.0 300.0,202.0 300.0,264.5 380.0,264.5" data-evidence="332-341" />
<rect class="edge-label-bg" x="258.1" y="219.2" width="131.9" height="22" rx="3" />
<text class="edge-label" x="324.0" y="234.2">principal 이름으로 조회</text>
<polyline class="edge kind-read style-solid emphasis-normal" points="220.0,184.0 305.2,184.0 305.2,121.5 390.5,121.5" data-evidence="326-331" />
<rect class="edge-label-bg" x="286.8" y="138.8" width="85.0" height="22" rx="3" />
<text class="edge-label" x="329.2" y="153.8">세션 id 로 조회</text>
<polyline class="edge kind-write style-solid emphasis-normal" points="557.5,121.5 646.2,121.5 646.2,108.5 735.0,108.5" data-evidence="347-351" />
<rect class="edge-label-bg" x="648.2" y="101.0" width="44.0" height="22" rx="3" />
<text class="edge-label" x="670.2" y="116.0">저장</text>
<g id="node-request">
<g class="actor-symbol emphasis-primary" data-evidence="326-331"><circle cx="145.0" cy="171.0" r="11.0" /><line x1="145.0" y1="187.0" x2="145.0" y2="196.0" /><line x1="127.0" y1="197.0" x2="163.0" y2="197.0" /><line x1="145.0" y1="196.0" x2="130.0" y2="213.0" /><line x1="145.0" y1="196.0" x2="160.0" y2="213.0" /></g>
<text class="node-label" x="145.0" y="228.0">브라우저 요청</text>
</g>
<g id="node-app-session">
<rect class="node-shape kind-component emphasis-primary role-store" data-evidence="335-341" x="390.5" y="86.0" width="167.0" height="71.0" rx="7" />
<text class="node-label" x="474.0" y="113.0">Application Session</text>
<line class="node-detail-divider" x1="404.5" y1="134.0" x2="543.5" y2="134.0" />
<text class="node-detail" x="406.5" y="151.0">조회 키: 세션 id</text>
</g>
<g id="node-authorized-client">
<rect class="node-shape kind-component emphasis-warning role-store" data-evidence="335-341" x="380.0" y="229.0" width="188.0" height="71.0" rx="7" />
<text class="node-label" x="474.0" y="256.0">OAuth2AuthorizedClient</text>
<line class="node-detail-divider" x1="394.0" y1="277.0" x2="554.0" y2="277.0" />
<text class="node-detail" x="396.0" y="294.0">조회 키: principal 이름</text>
</g>
<g id="node-redis">
<rect class="node-shape kind-datastore emphasis-primary role-target" data-evidence="347-351" x="735.0" y="73.0" width="251.0" height="71.0" /><ellipse class="node-shape kind-datastore emphasis-primary role-target" cx="860.5" cy="73.0" rx="125.5" ry="13.0" /><path class="storage-bottom" d="M 735.0 144.0 A 125.5 13.0 0 0 0 986.0 144.0" />
<text class="node-label" x="860.5" y="100.0">Redis</text>
<line class="node-detail-divider" x1="749.0" y1="121.0" x2="972.0" y2="121.0" />
<text class="node-detail" x="751.0" y="138.0">SPRING_SESSION_STORE_TYPE=redis</text>
</g>
<g id="node-postgres">
<rect class="node-shape kind-datastore emphasis-primary role-target" data-evidence="355-358" x="728.0" y="242.0" width="265.0" height="71.0" /><ellipse class="node-shape kind-datastore emphasis-primary role-target" cx="860.5" cy="242.0" rx="132.5" ry="13.0" /><path class="storage-bottom" d="M 728.0 313.0 A 132.5 13.0 0 0 0 993.0 313.0" />
<text class="node-label" x="860.5" y="269.0">PostgreSQL</text>
<line class="node-detail-divider" x1="742.0" y1="290.0" x2="979.0" y2="290.0" />
<text class="node-detail" x="744.0" y="307.0">JdbcOAuth2AuthorizedClientService</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.1 KiB