Skip to content

Overview

Markdown · llms.txt

opa-authzen-plugin

An extended version of OPA (OPA-AuthZEN) that implements the OpenID AuthZEN Authorization API 1.0 as a native OPA plugin.

Looking for opa-authzen? This is it. The repository and Go module are both named opa-authzen-plugin — import path github.com/dyokto/opa-authzen-plugin (v0.12.1 and earlier: github.com/kanywst/opa-authzen-plugin). The -plugin suffix is load-bearing: this is not a gateway or a sidecar in front of OPA, it is a plugin that makes OPA itself serve the AuthZEN endpoints.

┌──────────────────────────────────────────────────┐
│ OPA Process (:8181) │
│ │
│ ┌────────────────────────────────────────────┐ │
│ │ OPA HTTP Server │ │
│ │ │ │
│ │ Built-in Routes AuthZEN Routes │ │
│ │ ┌──────────────┐ ┌───────────────────┐ │ │
│ │ │ POST /v1/ │ │ POST /access/v1/ │ │ │
│ │ │ data/... │ │ evaluation │ │ │
│ │ │ GET /health │ │ POST /access/v1/ │ │ │
│ │ │ ... │ │ evaluations │ │ │
│ │ └──────────────┘ │ GET /.well-known/ │ │ │
│ │ │ authzen-config. │ │ │
│ │ └─────────┬─────────┘ │ │
│ └──────────────────────────────┼─────────────┘ │
│ │ │
│ ┌──────────────────────────────▼─────────────┐ │
│ │ AuthZEN Plugin (ExtraRoute) │ │
│ │ ┌─────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ Validate│ │ Evaluate │ │ Metadata │ │ │
│ │ │ Request │─▶│ Policy │ │ Endpoint │ │ │
│ │ └─────────┘ └─────┬────┘ └──────────┘ │ │
│ └─────────────────────┼──────────────────────┘ │
│ │ │
│ ┌─────────────────────▼──────────────────────┐ │
│ │ OPA Rego Engine + Store │ │
│ │ ┌──────────┐ ┌───────────┐ ┌─────────┐ │ │
│ │ │ Compiler │ │ In-Memory │ │ Bundles │ │ │
│ │ │ │ │ Store │ │ │ │ │
│ │ └──────────┘ └───────────┘ └─────────┘ │ │
│ └────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────┘

The plugin registers AuthZEN endpoints directly on OPA's own HTTP server (:8181) using OPA's ExtraRoute extension point. This means AuthZEN routes get OPA's built-in Prometheus metrics, OpenTelemetry tracing, and server authorization automatically — no separate port or listener required. The plugin writes its decisions to OPA's decision log itself (see Decision logs), since OPA's server only logs the routes it serves.

Spec Section Feature Status
Section 5 Information Model (Subject, Action, Resource, Context, Decision) ✅ Supported
Section 6 Access Evaluation API (POST /access/v1/evaluation) ✅ Supported
Section 7 Access Evaluations API (POST /access/v1/evaluations) ✅ Supported
Section 7.1.1 Default value merging for batch evaluations ✅ Supported
Section 7.1.2.1 Evaluation semantics (execute_all, deny_on_first_deny, permit_on_first_permit) ✅ Supported
Section 8 Search APIs (Subject, Resource, Action) ✅ Supported (opt-in via search config)
Section 8.2 Search pagination (stateless opaque token) ✅ Supported
Section 9 PDP Metadata (GET /.well-known/authzen-configuration) ✅ Supported
Section 9.1.3 Signed metadata (signed_metadata) ✅ Supported (opt-in; the JWT is signed outside the plugin)
Section 10.1 HTTPS Transport Binding (JSON serialization, Content-Type validation) ✅ Supported
Section 10.1.3 X-Request-ID echo ✅ Supported
Section 11.7 Request payload protection (body size limit, batch size limit) ✅ Supported
Obligations Core (Draft 1) Discovery, opt-in and per-type negotiation, PDP outcome rule ✅ Supported (opt-in via supported_obligations)
Access Request and Approval Profile (Draft 1) PDP discovery: access_request_endpoint, jwks_uri, capability URN ✅ Supported (opt-in) — see Configuration
Access Request and Approval Profile (Draft 1) Access Request / Task Status endpoints, approval workflow, token signing ❌ Not implemented — the profile permits a separate service to host these

The Authorization API itself is final at 1.0. The two profiles are not: both are titled Draft 1 upstream, and the 1_0 in their filenames and URLs is the document name, not a released version. Support for them is opt-in and their normative text can still move — the denial-binding rules in the Access Request and Approval profile changed in September 2026, after this plugin shipped support for its discovery members.

Use GitHub Issues to request features or file bugs.

The quick start installs the plugin, starts it with the policy in example/, and sends one denied and one allowed evaluation request. Docs site: https://dyokto.github.io/opa-authzen-plugin/.

Terminal window
make build
./opa-authzen-plugin run --server --config-file example/config.yaml example/policy.rego

This starts OPA on :8181 with the AuthZEN endpoints registered on the same server.

Terminal window
curl -s -X POST http://localhost:8181/access/v1/evaluation \
-H "Content-Type: application/json" \
-d '{
"subject": {"type": "user", "id": "alice", "properties": {"role": "admin"}},
"resource": {"type": "document", "id": "doc-123"},
"action": {"name": "delete"}
}'

The response should be:

{"decision":true}

Moved to docs/gateways.md.

The published image is ghcr.io/dyokto/opa-authzen-plugin. docs/docker.md has the docker run command and the Kubernetes example.

The plugin is configured under the plugins.authzen key in the OPA config file. Every key is described in docs/configuration.md.

Moved to docs/configuration.md.

Moved to docs/configuration.md.

Moved to docs/configuration.md.

Moved to docs/api.md.

Apache License 2.0. See LICENSE.