Skip to main content
Version: Latest (4.0.3)

AuthZEN Fine-Grained Authorization

cidaas provides fine-grained authorization beyond OAuth2 scopes and group/role restrictions through the OpenID AuthZEN standard. AuthZEN separates policy administration from policy decision and supports attribute-based policies (Rego/OPA), external data via Policy Information Points (PIP), and Relationship-Based Access Control (ReBAC).

Architecture

ComponentServiceResponsibility
Policy Managementpolicy-management-srvCreate and manage Rego policies, PIP and Discovery data-source registrations (URL, GraphQL config, credentials), search configuration, live/simulation version pins, optional sample entities, versions, export/import bundles, and ReBAC administration
Policy Decision Point (PDP)policy-decision-srvLive and simulation evaluation, search, explain, AuthZEN well-known discovery
ReBAC runtimerebac-srvDecision-time ReBAC permission checks and lookups used by PDP rebac.* Rego builtins
ReBAC storeRelation StoreStores relationship tuples and schema; optional per-tenant configuration

The source of truth for subjects, resources, and actions used in search is your own systems (IdP, CMDB, application database). Register that GraphQL API as a Discovery data source, the same way you register a PIP for evaluation attributes. policy-management-srv stores the registration (URL, query template, credentials), not your production catalog.

How It Fits With Permission Management

AuthZEN complements the mechanisms described in Permission Management:

MechanismUse case
ScopesCoarse-grained client permissions on APIs
Groups & rolesUser membership and login-time token claims
AuthZEN policiesFine-grained, context-aware authorization (ABAC) at runtime
ReBACGraph-based permissions (owner, editor, viewer, group membership)

Typical flow:

  1. Authenticate the user or service and obtain an access_token.
  2. Call the PDP evaluation API with subject, resource, action, and optional context.
  3. Use the decision boolean to allow or deny the operation in your application.

Required Scopes and Roles

Administrative APIs require OAuth2 scopes and CIDAAS_ADMINS group roles.

ScopePurpose
cidaas:authzen_evaluateEvaluate access and run live PDP search APIs
cidaas:authzen_simulateEvaluate access and run search on the simulation channel
cidaas:authzen_explainRun OPA explain traces on the live channel
cidaas:authzen_readRead policies, entities, data sources, ReBAC
cidaas:authzen_writeCreate and update AuthZEN resources
cidaas:authzen_deleteDelete AuthZEN resources
cidaas:authzen_rebac_readRead ReBAC schema and relationships
cidaas:authzen_rebac_writeWrite ReBAC schema and relationships
cidaas:resource_exportExport configuration bundles
cidaas:resource_importImport configuration bundles

Eligible roles in the CIDAAS_ADMINS group include ADMIN, SECONDARY_ADMIN, AUTHZEN_MANAGER, POLICY_READ, POLICY_CREATE, and POLICY_DELETE.

Evaluation and search APIs on policy-decision-srv require cidaas:authzen_evaluate (live) or cidaas:authzen_simulate (simulation).

warning
Deprecated scope: cidaas:authzen_management

cidaas:authzen_management is deprecated and will be removed. Do not request it for new clients. Existing tokens that still include it continue to work until removal. Grant the granular scopes in the table above instead:

Instead of cidaas:authzen_managementUse
Policy-management read (list/get, search-config, audit, discovery)cidaas:authzen_read
Policy-management create/update, modes, SearchConfig PUTcidaas:authzen_write
Deletescidaas:authzen_delete
Live PDP eval, search, cache invalidate, reloadcidaas:authzen_evaluate
Simulation PDPcidaas:authzen_simulate
Live explaincidaas:authzen_explain
ReBAC admincidaas:authzen_rebac_read / cidaas:authzen_rebac_write
Export / importcidaas:resource_export / cidaas:resource_import

Documentation

TopicDescription
Policy ManagementPolicies, entities, data sources, validation, versions, export/import
Live and simulationVersion pins and simulation-channel PDP APIs
Access EvaluationRuntime PDP evaluation, cache invalidation
AuthZEN SearchFilter policies, Discovery, SearchConfig, search APIs
AuthZEN SimulationPin versions and compare live vs simulation
ReBACReBAC schema, relationship tuples, Rego integration

OpenAPI References

APIOpenAPI
Policy Managementpolicy-management
Policy Decision (PDP)policy-decision
ReBAC (runtime)rebac

Quick Start

  1. Create a Rego policy via POST /policy-management-srv/admin/policies.
  2. Evaluate access with subject, resource, and action.

Policy Management

The policy-management-srv is the administrative API for AuthZEN authorization in cidaas. It stores Rego policies, PIP and Discovery data-source registrations, semantic versions, and ReBAC administration data. It does not replace your entity database.

Policies

Policies are written in Rego (Open Policy Agent) and must use package authzen. The evaluator looks for rules that set allow (or equivalent decision logic).

Policy structure


package authzen

default allow := false

allow if {

input.subject.properties.roles[_] == "admin"

input.action.name == "read"
}

The evaluation input object contains:

FieldDescription
subjectRequesting entity (id, type, properties)
resourceTarget resource (id, type, properties)
actionRequested action (name, properties)
contextAdditional context; PIP data appears under context.pip

Create a policy

APIDescriptionLink
Create policyStore a new Rego policyView API
List policiesList all tenant policiesView API
Get policyFetch policy by ID; optional version and channel (live | simulation)View API
Update policyReplace policy script and metadataView API
Update modesPin or clear liveVersionId / simulationVersionIdView API
Simulation revisionTenant hash used as a PDP simulation cache keyView API
Delete policySoft-delete policy and versionsView API

Example: create policy


curl -X POST 'https://{host}/policy-management-srv/admin/policies' \
-H 'access_token: {token}' \
-H 'Content-Type: application/json' \
-d '{
"name": "DocumentReadPolicy",
"script": "package authzen\n\ndefault allow := false\n\nallow if {\n input.action.name == \"read\"\n input.resource.properties.owner_id == input.subject.id\n}\n",
"language": "rego"
}'

Policy Validation

Before deploying changes, validate the full bundle or a proposed dry-run set.

APIDescriptionLink
Validate all policiesAsync compile/validate of current bundleView API
Dry-runValidate proposed policy changes without savingView API
Profile bundleProfile evaluation against a sample requestView API
SSE streamReceive validation progress eventsView API

Async endpoints return a task with ref. Connect to GET /policy-management-srv/sse/{ref} to receive PENDING, SUCCESS, or FAILURE events.

Data Sources (PIP and Discovery)

PIP (Policy Information Point) data sources fetch external attributes during evaluation. Discovery data sources are external GraphQL APIs the PDP calls at search time to list subjects, resources, or actions from your catalog.

communicationEP for Discovery is your GraphQL URL. A bundled sample endpoint at /policy-management-srv/authzen/discovery/graphql exists only so you can experiment without wiring your catalog first; do not treat it as the production source of truth.

FieldPIPDiscovery
typePIPDiscovery
keyRequired unique PIP keyOptional label
searchEntityTypeRequired: subject, resource, or action
graphqlConfigRequired (queryTemplate, resultPath, pagination); adapt templates to your schema
communicationEPExternal HTTP URLExternal GraphQL URL
apiAccessCredential setup (required)Credential setup (required)
matchingCriteriaSubject/resource/action type filters (* = all)Same; used to match a search request
APIDescriptionLink
Create data sourceRegister a PIP or your Discovery GraphQL endpointView API
List data sourcesOptional type filterView API
Get / update / deleteCRUD by IDView API
Discovery templatesStarting GraphQL query shape (adapt to your schema)View API
Bootstrap DiscoverySample sources pointing at the bundled GraphQL APIView API
Sample GraphQL discoveryExperimental catalog backed by the sample entities APIView API
Search configurationFilter queries and post-eval flagsView API

PIP data is available in Rego as input.context.pip.{key}.*. For connecting your GraphQL source, filter policies, and the optional sample catalog see AuthZEN Search.

Versions

Semantic versions track policy and ReBAC script history.

APIDescriptionLink
Create versionNew version for a policy or ReBAC artifactView API
Get version by IDFetch version documentView API
Get version by policyGET .../versions/{policyId}/{version}View API

Supported type values: POLICY, REBAC_SCHEMA, REBAC_RELATIONSHIP_TUPLE, REBAC_CAVEAT_PARAM.

Resource Export and Import

Move AuthZEN configuration between environments using cidaas-resource-bundle documents.

KindDescription
cidaas.authzen.policyRego policies
cidaas.authzen.datasourcePIP and Discovery sources
cidaas.authzen.entityAuthZEN subject, resource, and action entities
cidaas.authzen.searchconfigTenant search configuration singleton
cidaas.authzen.rebac.schemaVersioned ReBAC schema catalog entries
cidaas.authzen.rebac.relationship_tupleVersioned relationship tuple catalog entries
cidaas.authzen.rebac.caveat_paramVersioned caveat parameter catalog entries
APIDescriptionLink
ExportJSON or ZIP (format=zip); query kinds, includeDeleted, includeSecretsView API
Import previewDetect conflicts; returns importSessionIdView API
Import applyResolve conflicts and apply bundleView API

Conflict resolutions: SKIP, KEEP_EXISTING, REPLACE, REPLACE_ALL.

AuthZEN Entities (sample catalog)

These APIs store a sample subject/resource/action catalog for experiments. Production search does not read this store unless you register the bundled sample GraphQL endpoint as a Discovery data source. Your real entities stay in your own systems.

APIDescriptionLink
Create entityAdd a sample catalog rowView API
List entitiesList by entityType query (subject, resource, action)View API
Get / update / deleteCRUD by IDView API
Entity discoveryPaginated REST sample catalog (legacy)View API
Seed samplesDemo alice/bob/accounts/read/writeView API

Evaluation Audit

Every access evaluation performed by the PDP is recorded as an audit entry, capturing the original request(s) and the returned decision(s). Use these admin APIs to review or report on authorization activity.

APIDescriptionLink
Count auditsNumber of audit entries in a time rangeView API
List auditsAudit entries (newest first) with request and decisionView API

Both require a time range with from (required) and optional to (RFC 3339; defaults to now). Each audit entry contains evaluatedTime, tenantKey, refNumber, the request/response arrays, and evaluationCount (a single entry covers a whole batch request). Paginate the list by passing the response nextTime as the to of the next request. These read APIs require cidaas:authzen_read.

Webhooks and Activity

Policy create, update, and delete operations emit facts (AUTHZEN_POLICY_CREATED, AUTHZEN_POLICY_UPDATED, AUTHZEN_POLICY_DELETED) for activity streams and webhook integration.

Live and simulation

Each policy can pin a live version (liveVersionId) and a simulation version (simulationVersionId). An empty pin means that channel uses the working-copy script.

  • Live PDP routes: /policy-decision-srv/access/v1/*
  • Simulation PDP routes: /policy-decision-srv/access/v1/simulation/*

Caches are separate. See AuthZEN Simulation for pinning, diff vs live baseline, and a rollout checklist.

Access Evaluation (Policy Decision Point)

The policy-decision-srv is the AuthZEN Policy Decision Point (PDP). It evaluates Rego policies from policy-management-srv, merges PIP data from configured data sources, and exposes AuthZEN-standard evaluation and search APIs.

OpenAPI: policy-decision.

Discovery

Discover PDP endpoints via the AuthZEN configuration document:

APIDescriptionLink
AuthZEN configurationWell-known PDP metadataView API

GET /policy-decision-srv/.well-known/authzen-configuration returns:

  • policy_decision_point
  • access_evaluation_endpoint
  • access_evaluations_endpoint
  • search_subject_endpoint, search_resource_endpoint, search_action_endpoint
  • simulation_evaluation_endpoint, simulation_evaluations_endpoint, simulation_explain_endpoint
  • simulation_search_subject_endpoint, simulation_search_resource_endpoint, simulation_search_action_endpoint

Live explain is available at POST /policy-decision-srv/access/v1/explain and is not advertised in this well-known document. Only the simulation explain URL is returned (simulation_explain_endpoint).

Evaluation Workflow

Step 1: Ensure policies are current

The PDP auto-refreshes its live cache about every 10 seconds. That cache holds compiled policy evaluators, PIP definitions, Discovery data-source registrations, and SearchConfig. You do not need to invalidate after every change; wait for the next refresh.

Invalidate or reload only when you need the change on the next request:

ApproachAPIWhen to use
Wait for auto-refreshDefault. Live cache refreshes about every 10 seconds
Invalidate immediatelyPOST /access/v1/cache/invalidateApply policy, PIP, Discovery, or SearchConfig changes right away
Reload policiesPOST /access/v1/policies/reloadForce a re-fetch and rebuild of the live evaluator cache

Both operations accept an optional tenant_key body; when omitted, the tenant is resolved from the request token. They require cidaas:authzen_evaluate. Simulation evaluators use a separate cache that also auto-refreshes about every 10 seconds. See AuthZEN Simulation.

Step 2: Single evaluation

APIDescriptionLink
Evaluate accessSingle subject–action–resource decisionView API

Request:


{
"subject": {
"id": "user-123",
"type": "user",
"properties": {
"roles": ["admin"]
}
},
"resource": {
"id": "doc-456",
"type": "document",
"properties": {
"owner_id": "user-123"
}
},
"action": {
"name": "read"
},
"context": {}
}

Response:


{
"decision": true,
"context": {
"reason": "Policy evaluation completed"
}
}

Unlike policy-management admin APIs, evaluation responses follow the AuthZEN specification directly (no success wrapper).

Step 3: Batch evaluation

APIDescriptionLink
Batch evaluateMultiple decisions in one requestView API

Use options.evaluations_semantic to control evaluation order:

ValueBehaviour
execute_allEvaluate all requests (default)
deny_on_first_denyStop at first decision: false
permit_on_first_permitStop at first decision: true

Parent-level subject, resource, action, and context are inherited by each item in evaluations unless overridden per item.

Search APIs

Search uses filter policies (partial evaluation → UCAST → GraphQL) and optional post-evaluation with data.authzen.allow. The PDP calls the external GraphQL URL on the matched Discovery data source. Configure at least one Discovery source whose communicationEP is reachable. Full walkthrough: AuthZEN Search.

APIDescriptionLink
Search subjectsWho can perform action on resourceView API
Search resourcesWhich resources match criteriaView API
Search actionsWhich actions are permittedView API

Pagination uses page.token and page.limit (default 50). Responses include page.next_token and results. Simulation search URLs are under /access/v1/simulation/search/*.

PIP Data in Evaluation

When PIP data sources are configured in policy-management-srv, the PDP fetches matching endpoints and injects data into input.context.pip before Rego evaluation.

Example Rego using PIP:


package authzen

default allow := false

allow if {
input.context.pip.my_pip_key.data.customFields.account_id in input.context.pip.my_pip_key.data.customFields.consent_accounts
}

Authentication

All PDP endpoints require a valid bearer token (access_token header or Authorization: Bearer). Live evaluation and search need cidaas:authzen_evaluate. Simulation endpoints need cidaas:authzen_simulate. Live explain needs cidaas:authzen_explain.

info
Need Support?

Please contact us on our support page or reach out to cidaas support at [email protected].