hodei-authz-sdk-authz
Core traits and logic for the Hodei authorization framework.
Overview
hodei-authz-sdk-authz provides the fundamental traits and abstractions for building authorization systems with Cedar Policy. It defines interfaces for policy storage, cache invalidation, and entity/action mapping.
Features
- PolicyStore Trait: Abstract interface for policy storage backends
- CacheInvalidation Trait: Abstract interface for cache invalidation
- Entity/Action Traits: Map domain entities to Cedar Policy
- Error Types: Typed errors for better error handling
- Schema Discovery: Automatic Cedar schema generation via inventory
Installation
[]
= "0.1"
Usage
Implementing PolicyStore
use async_trait;
use ;
use PolicySet;
Implementing CacheInvalidation
use async_trait;
use ;
Using Derive Macros
use ;
use Hrn;
use ;
Traits
PolicyStore
Abstraction for policy storage backends (PostgreSQL, file system, etc.):
create_policy- Create a new policyget_policy- Retrieve a policy by IDlist_policies- List all policiesupdate_policy- Update an existing policydelete_policy- Delete a policyload_all_policies- Load all policies as a PolicySet
CacheInvalidation
Abstraction for distributed cache invalidation:
invalidate_policies- Publish invalidation eventsubscribe_to_invalidations- Subscribe to invalidation events
Error Types
PolicyStoreError- Errors from policy storage operationsCacheError- Errors from cache operations
Dependencies
cedar-policy- Cedar Policy enginehodei-authz-sdk-hrn- Core types (HRN)hodei-authz-sdk-derive- Derive macros
License
MIT OR Apache-2.0