liveBook · Manning

Policy template

As explained in Authorization in Action

A Cedar template is a reusable authorization policy containing reserved principal and resource slots that can be linked to concrete entity values to create specific policies.

When a service must grant many people access to specific documents, a Cedar policy template provides a reusable authorization pattern instead of requiring each policy to be handwritten. It keeps the policy structure fixed while reserving principal and resource values for later linking. section 9.7.1

Use templates selectively and govern their lifecycle:

  • Instantiate a template with concrete values for ?principal, ?resource, or both; Cedar does not support arbitrary template parameters such as ?owner or ?readers_team. section 9.7.1
  • Prefer relationship data for dynamic sharing such as team membership, ownership, management, and reader groups; reserve templates for explicit repeated grants. section 9.7.1
  • Validate linked entity types, tenancy, and existence; record template names and semantic versions, test changes, stage rollouts, and retain auditable links. section 9.7.1
  • Keep template ownership central while allowing product teams to supply constrained parameters and overrides for precise local exceptions. section 9.7.1

Direct document viewing

A fixed template can grant document-view permission to a linked principal and resource. Linking it for Alice and document 42 creates an explicit, auditable per-principal, per-resource grant; team-based sharing remains relationship-driven. section 9.7.1

// Template: direct-view-template
permit (
    principal == ?principal,
    action == ACME::Action::"doc:view",
    resource in ?resource
)

Inspect a Cedar template whose reserved slots are filled when the policy is linked to concrete entities. section 9.7.1

How Authorization in Action covers it

How deep it goes
Defines reserved slots, linking, validation, versioning, testing, rollout, ownership, and overrides, stopping short of arbitrary parameters.
Examples
Uses a direct document-view template linked to Alice and document 42, alongside team-based document sharing and external-sharing configuration.
What it assumes
Assumes Cedar entities and schemas, while teaching how reserved slots become concrete principals and resources.
What you can do after
Build repeated Cedar grants, validate their linked entities, audit template versions, and combine reusable rules with controlled overrides.
How it connects
Connects policy templates with relationship graphs, entity stores, schema validation, policy overrides, and tenant customization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Authorization in Action. The section links point to the parts of the book it draws on.