oatpp-authkit/test
Uwe Schuster 9040a9ec48 #14 PR 4: relocate users with temporal shape (Option B)
Lifts the auth-essential users table from fewo-webapp into oatpp-authkit
in temporal form per Option B from the issue body. The previous shape
(id INTEGER autoinc + is_active flag) is replaced with the entity_id +
valid_from/valid_until triple; soft-delete via valid_until = now()
instead of toggling is_active.

New files (all in oatpp-authkit):
- dto/UserDto.hpp — auth-essential columns only: id, entity_id, username,
  password_hash, role, tls_cert_dn, valid_from, valid_until. Registered
  as temporal so TemporalRepository composes cleanly. Application-
  specific columns (email, profile data) belong on a consumer-side DTO
  + parallel SchemaContract that contributes additional columns to the
  same users table.
- db/UserDb.hpp — DbClient with login-path queries (findLiveByUsername,
  findLiveByTlsCertDn) plus generic CRUD. UserSchema declares the
  schema: TEXT id, entity_id, username, password_hash, role, tls_cert_dn,
  with natural-key UNIQUE on (username, valid_until) so no two live rows
  can share a username while historical rows for the same username are
  allowed.
- repo/ConcreteUserRepository.hpp — Repository<UserDto> adapter +
  makeUserRepository factory wrapping in TemporalRepository.
- test/test_user_schema.cpp — verifies SchemaBuilder<UserSchema,
  TemporalRepository<UserDto>>::create produces the expected 5 DDL
  statements; specifically asserts is_active and created_at are NOT
  present in the temporal shape (Option B replacement).

13 of 13 tests pass. Bumped 0.11.0 → 0.12.0.

Per owner directive on authkit#14: password_hash rides the temporal row.
A separate security follow-up issue tracks the redaction policy for
historical password hashes (likely blank the hash but keep the row so
change-history is auditable).

The migration of an existing non-temporal users table to this shape is
documented in db/UserDb.hpp: Atlas-generated migration handles the
structural conversion + backfill (each existing row becomes its own
entity with entity_id = CAST(id AS TEXT)). Sessions/certificates FKs
that referenced users.id (INTEGER) need rewiring to reference
users.entity_id — that's a consumer-side rewire, separate PR.

Closes #14 — the four migration sub-PRs (PR 1 role_templates, PRs 2+3
permissions, PR 4 users) are now landed; the umbrella issue can close.
Follow-ups (security hash redaction, fewo-webapp consumer migration,
Atlas CI integration) get their own issues.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 12:57:59 +02:00
..
CMakeLists.txt #14 PR 4: relocate users with temporal shape (Option B) 2026-05-06 12:57:59 +02:00
test_audit_log_repository.cpp #13: TemporalRepository save — stable-live + historical-copy semantics 2026-04-30 00:10:03 +02:00
test_body_size_limit.cpp #4: BodySizeLimitInterceptor — fail-closed on missing/malformed Content-Length 2026-04-25 21:36:50 +02:00
test_json_serialization.cpp #6: route ad-hoc JSON through ObjectMapper (Option A — DI everywhere, all-in-one) 2026-04-25 21:56:05 +02:00
test_negotiation.cpp #2: Browser-friendly 401/403 — content-negotiate JSON vs HTML/redirect 2026-04-25 13:23:08 +02:00
test_queryable.cpp #9: Optional IQueryable<T> capability + in-house query AST 2026-04-29 12:55:29 +02:00
test_repository_decorators.cpp #13: TemporalRepository save — stable-live + historical-copy semantics 2026-04-30 00:10:03 +02:00
test_repository_interface.cpp #10: TemporalFieldTraits<T> — decouple decorator from canonical column names 2026-04-29 14:23:40 +02:00
test_role_template_schema.cpp #14 PR 1: relocate role_templates module + Atlas migration docs 2026-05-06 12:36:18 +02:00
test_schema_contract.cpp #14 PR 0: replace imperative migration kit with declarative SchemaContract 2026-05-06 12:14:51 +02:00
test_security_headers.cpp #3: SecurityHeadersInterceptor — strict baseline + CspOverride ctor (Option B) 2026-04-25 21:54:58 +02:00
test_temporal_field_traits.cpp #13: TemporalRepository save — stable-live + historical-copy semantics 2026-04-30 00:10:03 +02:00
test_user_permission_schema.cpp #14 PRs 2 & 3: relocate user_property_permissions + user_group_permissions 2026-05-06 12:39:52 +02:00
test_user_schema.cpp #14 PR 4: relocate users with temporal shape (Option B) 2026-05-06 12:57:59 +02:00