<!-- Generated by website/scripts/sync-docs.mjs from README.md. Edit that file, not this one. -->

# Overview

> Every page of this site: https://dyokto.github.io/opa-authzen-plugin/llms.txt

<img src="https://raw.githubusercontent.com/dyokto/.github/main/assets/projects/opa-authzen-plugin.png" width="96" alt="opa-authzen-plugin">

# opa-authzen-plugin


An extended version of OPA (**OPA-AuthZEN**) that implements the [OpenID AuthZEN Authorization API 1.0](https://openid.net/specs/authorization-api-1_0.html) 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.

## Architecture

```text
┌──────────────────────────────────────────────────┐
│               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](https://dyokto.github.io/opa-authzen-plugin/configuration/#decision-logs)), since OPA's server only logs the routes it serves.

## AuthZEN 1.0 Compliance

| 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)](https://openid.github.io/authzen/authzen-obligations-core-1_0.html) | Discovery, opt-in and per-type negotiation, PDP outcome rule | ✅ Supported (opt-in via `supported_obligations`) |
| [Access Request and Approval Profile (Draft 1)](https://openid.github.io/authzen/authzen-access-request-approval-profile-1_0.html) | PDP discovery: `access_request_endpoint`, `jwks_uri`, capability URN | ✅ Supported (opt-in) — see [Configuration](https://dyokto.github.io/opa-authzen-plugin/configuration/#access-request-and-approval-profile) |
| [Access Request and Approval Profile (Draft 1)](https://openid.github.io/authzen/authzen-access-request-approval-profile-1_0.html) | 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.

## Issue Management

Use [GitHub Issues](https://github.com/dyokto/opa-authzen-plugin/issues) to request features or file bugs.

## Quick Start

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

```bash
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.

```bash
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:

```json
{"decision":true}
```

## Documentation

- [docs/quickstart.md](https://dyokto.github.io/opa-authzen-plugin/quickstart/): install, start the server, then one denied, one allowed and one rejected request
- [docs/configuration.md](https://dyokto.github.io/opa-authzen-plugin/configuration/): every `plugins.authzen` key, [Obligations Core](https://dyokto.github.io/opa-authzen-plugin/configuration/#obligations-core), the [Access Request and Approval Profile](https://dyokto.github.io/opa-authzen-plugin/configuration/#access-request-and-approval-profile) and [Decision logs](https://dyokto.github.io/opa-authzen-plugin/configuration/#decision-logs)
- [docs/api.md](https://dyokto.github.io/opa-authzen-plugin/api/): request and response shapes for every endpoint
- [docs/gateways.md](https://dyokto.github.io/opa-authzen-plugin/gateways/): running the PDP behind Envoy or another API gateway
- [docs/docker.md](https://dyokto.github.io/opa-authzen-plugin/docker/): the container image, `docker run`, and Kubernetes
- [example/](https://dyokto.github.io/opa-authzen-plugin/examples/): example policies and configs, including ABAC, the AuthZEN interop Todo scenario and Envoy
- [RELEASE.md](https://dyokto.github.io/opa-authzen-plugin/release/#verifying-a-release): verifying release signatures
- [CHANGELOG.md](https://dyokto.github.io/opa-authzen-plugin/changelog/)

## API Gateway Integration

Moved to [docs/gateways.md](https://dyokto.github.io/opa-authzen-plugin/gateways/).

## Docker

The published image is `ghcr.io/dyokto/opa-authzen-plugin`. [docs/docker.md](https://dyokto.github.io/opa-authzen-plugin/docker/) has the `docker run` command and the Kubernetes example.

## Configuration

The plugin is configured under the `plugins.authzen` key in the OPA config file. Every key is described in [docs/configuration.md](https://dyokto.github.io/opa-authzen-plugin/configuration/).

### Obligations Core

Moved to [docs/configuration.md](https://dyokto.github.io/opa-authzen-plugin/configuration/#obligations-core).

### Access Request and Approval Profile

Moved to [docs/configuration.md](https://dyokto.github.io/opa-authzen-plugin/configuration/#access-request-and-approval-profile).

### Decision logs

Moved to [docs/configuration.md](https://dyokto.github.io/opa-authzen-plugin/configuration/#decision-logs).

## API Reference

Moved to [docs/api.md](https://dyokto.github.io/opa-authzen-plugin/api/).

## License

Apache License 2.0. See [LICENSE](https://github.com/dyokto/opa-authzen-plugin/blob/main/LICENSE).
