Skip to content

Policy Schema

The Keycard entity schema and the context attributes available in Cedar policy conditions

Keycard Policies are written in Cedar and validated against the typed schema on this page. For the Console walkthrough and the rule patterns that use these entities, see Access Policies.

Entity typeMaps to
Keycard::UserThe people who authenticate into a Zone
Keycard::ApplicationRegistered Applications and OAuth clients, acting for a User or on their own
Keycard::ResourceThird-party API Resources configured in the Zone (for example, Google Calendar, GitHub)
Keycard::RolePlatform-defined Roles held by Users and Applications through Role assignments
Keycard::CustomRoleCustomer-defined Roles. A separate entity type so identifiers can’t collide with platform Roles
Keycard::GroupGroups of Users, managed in the Zone
Keycard::RegistrationMethodEnum entity for Application registration methods
Keycard::CredentialTypeEnum entity for Application credential types
PropertyTypeDescription
identifierStringThe Application’s unique identifier
nameStringThe Application’s display name
registration_methodRegistrationMethodHow the Application was registered. See Keycard::RegistrationMethod
credential_typeCredentialType?The credential type used for authentication. Absent when not yet determined. See Keycard::CredentialType
traitsSet<String>Behavioral traits: "gateway" (acts as an API gateway), "mcp-provider" (provides MCP tools)
dependenciesSet<Resource>Resources the Application is configured to access directly (service-to-service)

Applications can hold Roles.

PropertyTypeDescription
identifierStringThe User’s unique identifier
emailStringThe User’s email address from their identity provider

Users can hold Roles and belong to Groups.

PropertyTypeDescription
identifierStringThe Resource’s unique identifier
nameStringHuman-readable Resource name
scopesSet<String>OAuth scopes associated with the Resource

Roles have no attributes. They are membership targets: a rule matches when the principal holds the Role, tested with Cedar’s in operator. The Role’s owner selects the entity type:

principal in Keycard::Role::"admin" // platform-defined
principal in Keycard::CustomRole::"deployer" // customer-defined (creating custom Roles is coming soon)

Only Users and Applications can hold Roles. See Role-based Policies for worked examples.

Groups have no attributes and, like Roles, are membership targets. The entity ID is the Group’s identifier, which is unique within the Zone:

principal in Keycard::Group::"data-analysts"

Only Users can be Group members. See Group-based Policies for worked examples.

ValueDescription
Keycard::RegistrationMethod::“managed”Created through the management API
Keycard::RegistrationMethod::“dcr”Registered through OAuth 2.0 Dynamic Client Registration
ValueDescription
Keycard::CredentialType::“token”Workload identity (short-lived tokens)
Keycard::CredentialType::“password”Client ID and secret
Keycard::CredentialType::“public-key”Key-based assertion
Keycard::CredentialType::“url”URL-based identity
Keycard::CredentialType::“public”Public client (no secret)

The Claims record type carries JWT claims for claim-based conditions.

PropertyTypeDescription
emailString?Email claim from the JWT, if present
groupsSet<String>?The groups claim as asserted by the upstream IdP (for example, Okta or Entra ID groups). This is a snapshot from one sign-in, not Keycard Group membership; for directory-backed membership use Keycard::Group

Every request carries a context record with its runtime state:

AttributeTypeDescription
on_behalfBoolWhether this is a delegated request (an Application acting for a User)
impersonateBoolWhether this is an impersonation request (an Application acting as the subject rather than on its behalf)
subjectUser?The User an Application acts for. Absent for direct Application access
resourceResource?The request’s target Resource, mirrored into context so conditions can reference it (for example, context.resource.identifier)
scopesSet<String>?OAuth scopes in the current request. Absent when none are requested
actor_claimsClaims?JWT claims for the actor making the request
subject_claimsClaims?JWT claims for the subject an Application acts on behalf of. Absent when there is no subject

Schema versions use a date format (for example, 2026-06-18). A Policy written against a version keeps working: Keycard only makes additive changes to a published version, such as new entity types or attributes.