Praetor

Strongly typed authorization for Rust.

A small library built around composable can and cannot rules. It composes rules, matches them, and returns a decision — nothing more.

claims + rules + action + subject/resource → allow / deny

Mechanics, not model

Praetor owns the rules. Your app owns the model.

Actions, subjects, claims, roles, permissions, and JWT formats all stay in your application. Praetor defines authorization mechanics — it composes rules, matches an action against a subject or a concrete resource, and returns an allow / deny decision. Authorization is a pure, in-memory operation.

Evaluation semantics

Two rules you never have to guess about

Default deny

If no rule matches a request, the decision is deny. Nothing is permitted implicitly — you grant access on purpose.

Last matching rule wins

Rules are evaluated in reverse, so later rules override earlier ones. A cannot_if after a broad can carves out an exception cleanly.

Ready?

Compose your first ability in minutes.