Skip to main content

Crate axiam_sdk_macros

Crate axiam_sdk_macros 

Source
Expand description

Proc-macro Actix-Web authorization attributes for the AXIAM Rust SDK.

This crate is an implementation detail of axiam-sdk; do not depend on it directly. The three attribute macros it exports are re-exported from axiam-sdk behind its macros feature, so consumers write use axiam_sdk::require_access; and never name this crate.

The macros implement the CONTRACT.md §11 declarative authorization helpers on top of the §10 AxiamUser route-guard extractor. They are deliberately thin: each one expands to a small wrapper that delegates to the runtime helpers in axiam_sdk::middleware (RequireAccess, resource_from_path, require_role_check, …), so the enforcement logic lives in ordinary, unit-testable library code rather than inside macro expansion.

  • require_auth — require an authenticated AXIAM identity (401 on failure).
  • require_access — require the authenticated caller to pass an AXIAM authorization check for an action on a request-resolved resource (401 unauthenticated, 403 denied, 400 unresolvable resource, 503 authz transport failure — fail closed).
  • require_role — require one of a set of roles, checked locally against the verified token’s claims (403 on failure).

Attribute Macros§

reactor_handler
Bind an async fn to one reactor hook event (CONTRACT.md §22.14).
require_access
Require the authenticated caller to pass an AXIAM authorization check on an Actix-Web handler (CONTRACT.md §11 require_access).
require_auth
Require an authenticated AXIAM identity on an Actix-Web handler (CONTRACT.md §11 require_auth).
require_role
Require one of a set of roles on an Actix-Web handler (CONTRACT.md §11 require_role).