iet-authz
core contracts official
Defines the ports for roles, resource grants, and policy decisions.
CoreFeaturesIntegrationsStacksTooling
Used byiet-auth-acliet-auth-acl-timescaleiet-auth-rbaciet-auth-rbac-timescale
iet-authzcontractsAuthorization contractsDepends oniet-corecontract
How to use it
iet-authz defines the authorization ports (RoleStore, AccessStore, ResourceAuthorizer) and combinators, and re-exports iet_core::Authorizer. All/Any let you compose policies, while DenyPermissions is the fail-closed default for authenticated-only applications.
// crates/core/iet-authz/tests/composition.rs
use ;
use ;
;
// Both must allow; a denial from either propagates.
All
.authorize
.await?;
// The first Forbidden falls through to the second; other errors do not.
Any
.authorize
.await?;
Anyswallows onlyErrorKind::Forbidden;Unavailable,Internal, orUnauthenticatedfrom the first policy are returned unchanged.DenyPermissionsalways returnsErrorKind::Forbidden(authz.denied), so a permission-protected operation can never accidentally succeed.
How it works
A CallContext and a permission string are given to some Authorizer. All and Any compose two policies, forwarding the decision and treating only ErrorKind::Forbidden from the first as a fall-through; DenyPermissions fails closed.
flowchart LR A["CallContext and permission"] --> B["Authorizer::authorize"] B --> C["All"] B --> D["Any"] B --> E["DenyPermissions"] C --> F["both must allow"] D --> G["Forbidden falls through"] E --> H["always Forbidden"]
Core contract
This page is the crate reference. For the framework-wide runtime and trait model, read Architecture.
What it implements
- Defines the traits other crates implement:
RoleStore,AccessStore,ResourceAuthorizer.
What's inside
Modules
src/lib.rs
Public API
(root)
- struct
DenyPermissions— Explicit deny-by-default policy for applications with authenticated-only operations. Permission-protected operations cannot accidentally succeed. - trait
RoleStore
- trait
AccessStore
- trait
ResourceAuthorizer
pub fn identity(context: &CallContext) -> AppResult<&Principal>pub fn denied() -> AppError- struct
All - struct
Any
Impl map
Authorizer for DenyPermissionsAuthorizer for All<A, B>Authorizer for Any<A, B>Authorizer for Policy
Depends on
Used by
In this repository
examples/handbook-notesexamples/htmx-starterexamples/skills-only-app-task-tracker
Source: crates/core/iet-authz