IhawuKtorConfig

Configuration for the IhawuKtor plugin — the analogue of the Spring Boot starter's beans.

Supply, at minimum, the field-policy source (policies or policyResolver) and the resources registry; wire resolvePrincipal to your Authentication to identify the caller.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
var json: Json

The JSON used to encode responses and decode request bodies.

Link copied to clipboard

Notified on each fail-closed drop; defaults to a no-op so the adapter needs no logger.

Link copied to clipboard

How a policy-resolver failure (a policy-store outage or misconfiguration) is handled. Defaults to ResolverErrorMode.MASK_ALL — mask the whole resource fail-closed ({}, still 200). ResolverErrorMode.FAIL_REQUEST instead lets the error surface as a 500, so an outage is not silent (only the resolver-error path; a missing principal still masks). See ADR 0011.

Link copied to clipboard
var resolvePrincipal: suspend (ApplicationCall) -> IhawuPrincipal?

Resolves the caller for each request. The default fails closed — a null principal masks the whole resource ({}), matching the other adapters. In production map your Authentication result here, e.g. resolvePrincipal = { it.ihawuPrincipal() }.

Functions

Link copied to clipboard
fun policies(vararg rules: ResourcePolicy)

Resolve field policies from static role-based rules.

Link copied to clipboard

Resolve field policies with a custom ResourcePolicyResolver (a DB, OPA, Casbin, …).

Link copied to clipboard
fun resources(vararg entries: Pair<KSerializer<*>, String>)

Register each @IhawuResource serializer under its resource name so it masks when serialized. Register nested resource types and collection element types too, so they mask when reached.