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>
61 lines
2.7 KiB
Markdown
61 lines
2.7 KiB
Markdown
---
|
|
kind: CONCEPT
|
|
slug: adapter-inbound-web-c04
|
|
title: publicPaths가 먼저 등록되어 제한 경로 규칙을 덮는다
|
|
topic: security-and-trust-boundaries
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: concept:adapter-inbound-web-c04
|
|
evidenceCapturedOn: 2026-09-01
|
|
assets:
|
|
- key: adapter-inbound-web-c04
|
|
file: ../../../final/evidence/rendered/adapter-inbound-web-c04.svg
|
|
- key: adapter-inbound-web-c04-diagram
|
|
file: ../../../final/assets/diagrams/adapter-inbound-web-c04.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/adapter-inbound-web-c04.txt
|
|
source:
|
|
- 원본 분석 절은 analysis/14-adapter-inbound-web.md#L473 이다.
|
|
module: adapter-inbound-web
|
|
---
|
|
|
|
# publicPaths가 먼저 등록되어 제한 경로 규칙을 덮는다
|
|
|
|
`SecurityConfig`가 `publicPaths`를 `RestrictedPathRule`보다 먼저 등록한다. Spring Security는 첫 일치가 이기므로, 주석이 말하는 순서는 `anyRequest()`에 대해서만 성립하고 `publicPaths`에 대해서는 반대다.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
매처가 등록되는 순서는 이렇다.
|
|
|
|
```java
|
|
// SecurityConfig.java:83-94
|
|
.authorizeHttpRequests(auth -> {
|
|
if (publicPaths.length > 0) { auth.requestMatchers(publicPaths).permitAll(); } // ← 먼저
|
|
for (RestrictedPathRule rule : restricted) { // ← 나중
|
|
auth.requestMatchers(rule.pathPattern()).hasAnyAuthority(rule.authorities());
|
|
}
|
|
auth.anyRequest().authenticated();
|
|
})
|
|
```
|
|
|
|
## 매처가 등록되는 순서
|
|
|
|
:::evidence key="adapter-inbound-web-c04-diagram" alt="공개 경로 매처와 제한 경로 규칙과 인증 요구 매처가 왼쪽에서 오른쪽으로 이어지고 화살표에 등록 순서가 붙은 구조" caption="매처가 등록되는 순서" zoom="false"
|
|
:::
|
|
|
|
Spring Security는 첫 일치가 이긴다. 주석은 "Ordered before the authenticated catch-all: **a management path must be refused at the transport**"라고 하는데, 그 순서는 `anyRequest()`에 대해서만 성립하고 `publicPaths`에 대해서는 반대다. §12.3.
|
|
|
|
## RestrictedPathRule 참조 위치
|
|
|
|
:::evidence key="adapter-inbound-web-c04" alt="코드베이스에서 RestrictedPathRule 를 검색한 출력 8줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="RestrictedPathRule 코드베이스 검색 — 8줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
## 실제로 등록되는 값
|
|
|
|
프로덕션 `RestrictedPathRule` 생산자는 하나다 — `FileserverAdminPlaneConfiguration:36`이 fileserver 관리 경로를 등록한다. `publicPaths`의 기본값은 `${SECURITY_PUBLIC_PATHS:${PRESENTATION_API_BASE_PATH:/v1}/healthcheck}`로, 환경변수 하나로 전체가 대체된다.
|
|
|
|
<!-- body:end -->
|