Skip to content

Pre-1.0 (v0.13.0). The Authorization API is final at 1.0; the Obligations Core and the Access Request and Approval profile it supports opt-in are Draft 1 and can still change.

opa-authzen-plugin

OPA, servingthe AuthZEN API.

opa-authzen-plugin is OPA with a plugin that serves the OpenID AuthZEN Authorization API 1.0 on OPA's own HTTP server: access evaluation, batch evaluations, subject, resource and action search, and PDP metadata. Your Rego policy decides; any AuthZEN PEP can ask. It is not a gateway or a sidecar in front of OPA.

  • Go
  • one static binary
  • AuthZEN 1.0
  • Apache-2.0

Quick start

Start opa-authzen-plugin with the example policy from this repository, then send it AuthZEN evaluation requests with curl: one that the policy denies, the same request changed so that it is allowed, and one that is rejected before the policy runs. You need curl and jq, and Go, Docker or nothing else depending on how you install it.

Linux and macOS binary

Releases ship bare binaries, not archives: opa_authzen_linux_amd64, opa_authzen_linux_arm64, opa_authzen_darwin_amd64, opa_authzen_darwin_arm64 and opa_authzen_windows_amd64.exe, from the releases page.

Terminal window
gh release download -R dyokto/opa-authzen-plugin -p opa_authzen_linux_amd64
sudo install opa_authzen_linux_amd64 /usr/local/bin/opa-authzen-plugin

Container image

Multi-arch (linux/amd64, linux/arm64) at ghcr.io/dyokto/opa-authzen-plugin, tagged with the release version without the v.

Terminal window
docker pull ghcr.io/dyokto/opa-authzen-plugin:0.13.0

The image's entrypoint is the plugin binary. In Start the server, run the container below instead of the opa-authzen-plugin run line, and stop it with docker rm -f authzen at the end. --addr 0.0.0.0:8181 is needed because OPA binds localhost by default, which a published port cannot reach.

Terminal window
docker run -d --name authzen -p 8181:8181 -v "$PWD/example:/example:ro" \
ghcr.io/dyokto/opa-authzen-plugin:0.13.0 \
run --server --addr 0.0.0.0:8181 --config-file /example/config.yaml /example/policy.rego

Go

Needs Go 1.26.1 or later (the go line in go.mod). Installs to $(go env GOPATH)/bin.

Terminal window
go install github.com/dyokto/opa-authzen-plugin/cmd/opa-authzen-plugin@latest

The binary is OPA with the AuthZEN plugin compiled in, so it has every opa subcommand. version prints the version of OPA it is built on (OPA 1.23.0 for v0.13.0), not the plugin release:

Terminal window
$ opa-authzen-plugin version
Version: 1.23.0
...

The policy and config are example/policy.rego and example/config.yaml.

Terminal window
git clone --depth 1 https://github.com/dyokto/opa-authzen-plugin
cd opa-authzen-plugin

The config enables the plugin and names the package and rule that decide:

plugins:
authzen:
path: "authzen"
decision: "allow"

This starts OPA on localhost:8181 with the AuthZEN endpoints on the same server, in the background, and waits until it answers. --log-level error keeps its request log out of your terminal.

Terminal window
$ opa-authzen-plugin run --server --log-level error \
--config-file example/config.yaml example/policy.rego &
$ until curl -sf -o /dev/null http://localhost:8181/health; do sleep 0.2; done

Bob asks to delete a document. Nothing in the policy allows it, so default allow = false decides:

Terminal window
$ curl -s http://localhost:8181/access/v1/evaluation \
-H 'Content-Type: application/json' \
-d '{"subject": {"type": "user", "id": "bob"}, "action": {"name": "delete"}, "resource": {"type": "document", "id": "doc-123"}}'
{"decision":false}

A denial is a 200 response with "decision": false, not an HTTP error status.

The first rule in the policy allows any action for a subject with the admin role:

default allow = false
# Allow if the subject has the "admin" role.
allow if input.subject.properties.role == "admin"

Send the same request with that property on the subject:

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

A request without subject, action or resource is rejected with 400 before the policy is evaluated:

Terminal window
$ curl -s -w '%{http_code}\n' http://localhost:8181/access/v1/evaluation \
-H 'Content-Type: application/json' \
-d '{"subject": {"type": "user", "id": "bob"}}'
{"error":"subject, action, and resource are required"}
400

/access/v1/evaluations takes defaults at the top level and one item per decision (Section 7). Reading is allowed for any subject with an id; deleting is not:

Terminal window
$ curl -s http://localhost:8181/access/v1/evaluations \
-H 'Content-Type: application/json' \
-d '{"subject": {"type": "user", "id": "bob"}, "resource": {"type": "document", "id": "doc-123"}, "evaluations": [{"action": {"name": "read"}}, {"action": {"name": "delete"}}]}'
{"evaluations":[{"decision":true},{"decision":false}]}

The PDP metadata (Section 9) lists the endpoints this server serves. The example config sets the three search rules, so the search endpoints are listed too:

Terminal window
$ curl -s http://localhost:8181/.well-known/authzen-configuration | jq .
{
"policy_decision_point": "http://localhost:8181",
"access_evaluation_endpoint": "http://localhost:8181/access/v1/evaluation",
"access_evaluations_endpoint": "http://localhost:8181/access/v1/evaluations",
"search_subject_endpoint": "http://localhost:8181/access/v1/search/subject",
"search_resource_endpoint": "http://localhost:8181/access/v1/search/resource",
"search_action_endpoint": "http://localhost:8181/access/v1/search/action"
}

Stop the server when you are done:

Terminal window
kill %1

checksums.txt is signed keylessly with cosign by the release workflow, and each image is signed by digest by the image workflow. Releases up to v0.12.1 were signed under kanywst/opa-authzen-plugin; RELEASE.md has the commands for those.

Terminal window
$ gh release download -R dyokto/opa-authzen-plugin \
-p checksums.txt -p checksums.txt.sigstore.json -p opa_authzen_linux_amd64
$ cosign verify-blob checksums.txt \
--bundle checksums.txt.sigstore.json \
--certificate-identity-regexp '^https://github\.com/dyokto/opa-authzen-plugin/\.github/workflows/post-tag\.yaml@refs/tags/v' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
Verified OK
$ sha256sum --check --ignore-missing checksums.txt
opa_authzen_linux_amd64: OK
$ cosign verify ghcr.io/dyokto/opa-authzen-plugin:0.13.0 \
--certificate-identity-regexp '^https://github\.com/dyokto/opa-authzen-plugin/\.github/workflows/publish\.yaml@refs/tags/v' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com > /dev/null
Verification for ghcr.io/dyokto/opa-authzen-plugin:0.13.0 --
The following checks were performed on each of these signatures:
- The cosign claims were validated
- Existence of the claims in the transparency log was verified offline
- The code-signing certificate was verified using trusted certificate authority certificates

The image also carries a BuildKit SPDX SBOM and SLSA provenance, and the release carries opa_authzen_sbom.spdx.json for the source module.

  • Configuration: every plugins.authzen key, obligations, the Access Request and Approval profile, and decision logs
  • API reference: request and response shapes for each endpoint, including search
  • API gateway integration: Envoy in front of the PDP
  • Examples: ABAC, the AuthZEN interop Todo scenario, and Kubernetes

Documentation

Docs

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

Guides

  • Configuration The plugin is configured under the plugins.authzen key in the OPA config file:
  • API gateways opa-authzen-plugin can serve as a standards-based PDP behind any API gateway that supports external authorization. The example/envoy-gateway/ directory demonstrates this pattern with Envoy proxy:
  • Docker and Kubernetes For Kubernetes, example/kubernetes/ has a Deployment and Service you can apply with kubectl apply -k.

Reference

  • API reference The plugin serves these endpoints on OPA's own HTTP server (:8181 by default). The quick start calls the evaluation endpoints against the policy in example/.

Examples

  • Overview This directory contains example configuration and policy files for opa-authzen-plugin.
  • ABAC Example Attribute-Based Access Control using subject properties (department, clearance level), resource properties (classification, department), and context (business hours).
  • Todo App Example Role-based authorization for a Todo application, based on the AuthZEN Interop Todo scenario.
  • Envoy Gateway + AuthZEN Integration Demonstrates using opa-authzen-plugin as a standards-based PDP behind an Envoy proxy. This example uses the Todo scenario from the AuthZEN Interop.
  • Kubernetes Runs opa-authzen-plugin as a Deployment behind a ClusterIP Service, with the plugin config and policy mounted from a ConfigMap.
  • Interop Todo PDP An OPA + Rego PDP implementation for the OpenID AuthZEN interop Todo scenario, served by this plugin. It used to live in the separate kanywst/opa-authzen-interop repository; it moved here so that…

Project

  • Changelog All notable changes to opa-authzen-plugin will be documented in this file.
  • Releases and verification This document describes the process for releasing new versions of opa-authzen-plugin.
  • Security policy If you discover a security vulnerability in opa-authzen-plugin, please do not open a public issue. Instead, please email the maintainer directly:
  • Contributing Thank you for your interest in contributing to opa-authzen-plugin! This guide will help you get started.
  • Code of conduct opa-authzen-plugin follows the CNCF Code of Conduct.

Security

Fails closed

Input that cannot be parsed, verified or resolved is a deny. There is no flag that skips verification outside test builds.

Signed releases

Each release has a cosign-signed checksums.txt and an SPDX SBOM; each image is cosign-signed by digest and carries an SBOM and SLSA provenance. Releases

Reporting a vulnerability

Use GitHub private vulnerability reporting, not a public issue. Security policy