Package-level declarations
Policy resolution — split into the contracts you integrate against and the provided implementations you can use as-is or compose.
Contracts & data model
The vocabulary Ihawu speaks regardless of where policies come from. Implement or supply these to integrate any policy source (config, database, OPA, Casbin, …):
ResourcePolicyResolver — the strategy interface Ihawu calls to resolve a resource's policies for a principal. Ihawu enforces what it returns; it never evaluates conditions itself.
IhawuPrincipal — the authenticated identity a resolution is performed for (resolution input).
FieldPolicy — a resolved masking decision for one field (resolution output).
ResourcePolicy — static
resource → role → field policiesrules consumed by RoleBasedResourcePolicyResolver.
Provided implementations
Batteries-included ResourcePolicyResolvers. Optional — reach for these before writing your own:
RoleBasedResourcePolicyResolver — the default, no-external-dependency resolver driven by static ResourcePolicy rules (supplied directly or loaded from JSON).
CachingResourcePolicyResolver — a memoizing decorator that resolves each
(principal, resource)at most once per instance lifetime. Wrap any resolver; control cache scope by controlling the instance (e.g. one per request).
Policy resolution — split into the contracts you integrate against and the provided implementations you can use as-is or compose.
Contracts & data model
The vocabulary Ihawu speaks regardless of where policies come from. Implement or supply these to integrate any policy source (config, database, OPA, Casbin, …):
ResourcePolicyResolver — the strategy interface Ihawu calls to resolve a resource's policies for a principal. Ihawu enforces what it returns; it never evaluates conditions itself.
IhawuPrincipal — the authenticated identity a resolution is performed for (resolution input).
FieldPolicy — a resolved masking decision for one field (resolution output).
ResourcePolicy — static
resource → role → field policiesrules consumed by RoleBasedResourcePolicyResolver.
Provided implementations
Batteries-included ResourcePolicyResolvers. Optional — reach for these before writing your own:
RoleBasedResourcePolicyResolver — the default, no-external-dependency resolver driven by static ResourcePolicy rules (supplied directly or loaded from JSON).
CachingResourcePolicyResolver — a memoizing decorator that resolves each
(principal, resource)at most once per instance lifetime. Wrap any resolver; control cache scope by controlling the instance (e.g. one per request).
Types
A ResourcePolicyResolver decorator that memoizes the wrapped resolver's results, so resolution happens at most once per (principal, resource) for the lifetime of this instance.
A resolved masking decision for a single field - the output of policy resolution.
The static masking rules for a single resource, consumed by RoleBasedResourcePolicyResolver.
Strategy for resolving the masking policies that apply to a resource requested for a given principal.
A configuration-backed ResourcePolicyResolver that resolves static, role-based masking rules.