Policy Library
This library collects reusable Rego patterns for PBAC extensions. Each entry follows the same structure: the problem it solves, a complete Rego implementation, the policy data it reads, a test you can run against a live instance, and common variations.
All examples target the oauth.evaluations_ext package (called during /token and /introspect) unless otherwise noted. For background on how extensions work, see the Rego for PBAC primer.
Patterns
| Pattern | What it does |
|---|---|
| Deny by Default | Start with everything denied. Grant access via explicit allowlists in policy data. |
| Attribute-Based Access | Gate decisions on software statement claims, subject attributes, or PIP-sourced data. |
| Time-Bound Access | Set short token TTLs for agent clients, restrict access to business hours, or expire grants automatically. |
| Delegation Chains | Validate token exchange chains — enforce depth limits and prevent scope expansion across hops. |
| Agent Trust Tiers | Provider-based trust levels for MCP agents — scope denial, TTL reduction, and single-use tokens. |