260804_01_ENH: api key에 특정 경로 허용 제외 추가

This commit is contained in:
2026-08-04 16:56:42 +09:00
parent 2954565fc7
commit 1ac8dab45a
6 changed files with 112 additions and 4 deletions

View File

@@ -112,8 +112,13 @@ Security note: default secrets in source are not production-safe. Documentation
Behavior:
- API key is read from `kri.auth.apikey.header-name`, default `X-API-Key`.
- `kri.auth.apikey.allowed-paths` limits where API key authentication is attempted. Unset, `null`, empty, or blank-only lists preserve the legacy all-request behavior; one or more valid patterns restrict authentication to matching paths.
- `kri.auth.apikey.excluded-paths` skips API key authentication on matching paths. Exclusions take precedence when a request matches both an allowed and an excluded pattern.
- API key path matching uses Spring `PathPatternRequestMatcher`, ignores HTTP method and query strings, and matches the path within the application after removing the context path.
- `allowed-paths` and `excluded-paths` do not grant access or alter `kri.security.public-paths`; they only scope the API key authentication filter.
- If authentication already exists in `SecurityContextHolder`, API key filter does nothing.
- If provider resolves a key, the result is converted to `Authentication` using `JwtService.toAuthentication`.
- DB preload auto-configuration requires Spring Data JPA on the classpath; a consumer-provided `ApiKeyUserClaimsProvider` remains usable without JPA.
- Preloaded provider returns empty cache when `service-code` is blank.
- Admin endpoint is exposed only when `admin-api-enabled=true` and the preload provider exists.
- Admin endpoint has IP allowlist enforcement.