FC/IS Shell Layer - User module service coordination.
This is the SHELL layer in Functional Core / Imperative Shell architecture. The shell coordinates between:
Shell responsibilities:
The shell does NOT contain business logic - that lives in core.* The shell does NOT handle database operations - that lives in persistence.*
FC/IS Shell Layer - User module service coordination. This is the SHELL layer in Functional Core / Imperative Shell architecture. The shell coordinates between: - Pure functional CORE (wagoe.user.core.*) - I/O SHELL persistence (wagoe.user.shell.persistence) Shell responsibilities: 1. Coordinate calls between core and persistence layers 2. Manage external dependencies (time, UUIDs, logging) 3. Handle all side effects and I/O operations 4. Orchestrate transaction boundaries 5. Transform between external and internal representations The shell does NOT contain business logic - that lives in core.* The shell does NOT handle database operations - that lives in persistence.*
Per-request audit context bound by HTTP/CLI interceptors. Expected keys: :actor-id, :actor-email, :ip-address, :user-agent.
Per-request audit context bound by HTTP/CLI interceptors. Expected keys: :actor-id, :actor-email, :ip-address, :user-agent.
(create-user-service user-repository
session-repository
audit-repository
validation-config
auth-service)(create-user-service user-repository
session-repository
audit-repository
validation-config
auth-service
observability)Create a user service instance with injected repositories, validation config, and auth service.
Args: user-repository: Implementation of IUserRepository session-repository: Implementation of IUserSessionRepository audit-repository: Implementation of IUserAuditRepository validation-config: Map containing validation policies and settings auth-service: Implementation of IAuthenticationService observability: Optional {:logger :metrics-emitter :error-reporter}; each operation logs, counts and reports through what it holds
Returns: UserService instance
Example: (def service (create-user-service user-repo session-repo audit-repo validation-cfg auth-svc))
Create a user service instance with injected repositories, validation config, and auth service.
Args:
user-repository: Implementation of IUserRepository
session-repository: Implementation of IUserSessionRepository
audit-repository: Implementation of IUserAuditRepository
validation-config: Map containing validation policies and settings
auth-service: Implementation of IAuthenticationService
observability: Optional {:logger :metrics-emitter :error-reporter}; each
operation logs, counts and reports through what it holds
Returns:
UserService instance
Example:
(def service (create-user-service user-repo session-repo audit-repo validation-cfg auth-svc))(effective-audit-context {:keys [default-actor-id default-actor-email]})Build final audit context by combining defaults with bound request context.
Build final audit context by combining defaults with bound request context.
(generate-secure-token)Generate cryptographically secure random token for sessions. This is a shell layer responsibility as it involves external randomness.
Generate cryptographically secure random token for sessions. This is a shell layer responsibility as it involves external randomness.
(generate-user-id)Generate UUID for new users. Shell layer responsibility.
Generate UUID for new users. Shell layer responsibility.
(interceptor-system user-service)The interceptor :system for a user HTTP or CLI handler.
The interceptor :system for a user HTTP or CLI handler.
(request-audit-context request)The audit context of a Ring request: its signed-in user is the actor.
The audit context of a Ring request: its signed-in user is the actor.
(with-audit-context audit-context f)Execute f with audit context bound for downstream service calls.
Execute `f` with audit context bound for downstream service calls.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |