Skip to content

feat(compliance): expose the kyc rest api with oauth2 security - #278

Merged
tiana-code merged 1 commit into
mainfrom
feat/E-04-kyc-rest
Jun 19, 2026
Merged

feat(compliance): expose the kyc rest api with oauth2 security#278
tiana-code merged 1 commit into
mainfrom
feat/E-04-kyc-rest

Conversation

@tiana-code

Copy link
Copy Markdown
Owner

Completes the KYC vertical of E-04 Compliance (#275, the web layer split from #265).

What

  • KycController: POST /v1/kyc/sessions (compliance:write, 201 + Location) and GET /{id} (compliance:read); thin methods, value-class id crosses the wire as a prefixed-ULID string via a hand KycApiMapper.
  • SecurityConfig: OAuth2 resource server; GET /v1/kyc/** = compliance:read, mutating = compliance:write; public = swagger/api-docs + actuator health + prometheus; stateless, csrf disabled.
  • RFC7807 GlobalExceptionHandler + ProblemType: not-found -> 404, illegal transition / optimistic-lock -> 409, validation / unreadable / bad id -> 400, fallback -> 500.
  • build.gradle.kts: data-JPA -> full web (web/security/oauth2/actuator/validation/springdoc/micrometer/otel + observability). application.yml: oauth2 issuer-uri, management health/info/prometheus, structured logging + PII masking (keeps the Liquibase change-log).
  • Tests: @WebMvcTest (201/401/403/200/404/400 scope cases, mock service + JwtDecoder) + a @SpringBootTest context IT (Testcontainers + fake KycProvider + mock JwtDecoder + @DynamicPropertySource) asserting the OpenAPI doc and an end-to-end POST+GET round-trip through Postgres.

Notes

Gate chain

  • critic: GO (3 LOW care notes honored).
  • security-auditor (opus): PASS - authz fails-closed, no public KYC data path, no PII in errors, 5/5 ACs.
  • code-reviewer: 1 substantive must-fix adopted (end-to-end round-trip IT); 2 declined with payments-parity evidence.
  • evaluator: PASS (0.87).
    All local gates green; the context IT runs on CI.

Closes #275

Turn the compliance module into an OAuth2 resource server and expose the
KYC session lifecycle over HTTP: POST /v1/kyc/sessions starts a session
and GET /v1/kyc/sessions/{id} reads it, guarded by compliance:write and
compliance:read scopes. Errors follow RFC 7807, ids cross the wire as
prefixed-ULID strings via a hand mapper, and the service ships the
standard health, prometheus and structured-logging baseline. The
Idempotency-Key handling is split into a follow-up.

Closes #275
@tiana-code tiana-code added this to the v0.3.0 milestone Jun 19, 2026
Comment thread services/compliance/src/main/kotlin/com/fincore/compliance/config/SecurityConfig.kt Dismissed
@tiana-code
tiana-code merged commit 2cb612a into main Jun 19, 2026
8 checks passed
@tiana-code
tiana-code deleted the feat/E-04-kyc-rest branch June 19, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F-04.5b KYC REST + security + OpenAPI

2 participants