Skip to content

5.2 Domain and Persistence

Sprint: Sprint 05 - Security and Identity
Feature ID: 5.2
Subtasks: 5.2.1, 5.2.2

Objective

Deliver "Domain and Persistence" within Sprint 05 - Security and Identity.

Dependencies

Aggregated from the subtasks below (prerequisite task IDs and enablers):

  • 5.1.2
  • 5.2.1

Subtasks

5.2.1 User, Role, Permission domain and entities

  • ID: 5.2.1
  • Title: Implement User/Role/Permission domain model and JPA entities
  • Description: Domain aggregate User (status PENDING/ACTIVE/LOCKED) with role assignment behavior; Role, Permission value/entity types; JPA entities mapping to the schema. Credentials are owned by Keycloak (ADR-011) and are NOT stored here; user provisioning/role changes call the Keycloak Admin API. Keep domain logic framework-independent (ARC-02).
  • Business Purpose: RBAC foundation (FR-IAM-04).
  • Inputs: 5.1.2.
  • Outputs: Domain types, JPA entities, Keycloak Admin API client.
  • Acceptance Criteria:
  • A user can be assigned roles and resolve effective permissions; no credentials are stored locally (Keycloak owns them).
  • Dependencies: 5.1.2
  • Complexity: M

5.2.2 Repositories

  • ID: 5.2.2
  • Title: Implement user/role/permission repositories
  • Description: Spring Data repositories for users (by keycloak_id/username/email), roles, and permissions. No refresh-token repository - tokens are Keycloak's (ADR-011).
  • Business Purpose: Data access for the identity projection and RBAC.
  • Inputs: 5.2.1.
  • Outputs: Repository interfaces.
  • Acceptance Criteria:
  • Lookups by keycloak_id, username, and email return expected results in a slice/integration test.
  • Dependencies: 5.2.1
  • Complexity: S

Acceptance Criteria

Each subtask above carries its own objective, testable acceptance criteria. This feature is complete when every subtask's acceptance criteria are met.

Deliverables

  • Domain types, JPA entities, password encoder.
  • Repository interfaces.

Definition of Done

  • All subtasks (5.2.1, 5.2.2) completed and their acceptance criteria verified.
  • All listed dependencies satisfied.
  • Build and tests green per the global conventions in ../README.md (Section 3).