opa

package
v3.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package opa provides a supported-adapter Open Policy Agent policy engine.

Use New with Config when authorization.NewPolicyAuthorizer should delegate provider-neutral policy requests to an OPA endpoint. The adapter maps request input to JSON, reads the configured result key, treats malformed or non-2xx responses as failures, and keeps client-facing errors generic.

This contrib adapter remains outside the stable core API promise. Keep OPA query paths, timeouts, and policy documents application-owned.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client evaluates policies through OPA's REST API.

func New

func New(cfg Config) (*Client, error)

New creates a new OPA adapter.

func (*Client) Evaluate

Evaluate calls OPA with the given policy request.

type Config

type Config struct {
	DecisionURL  string
	BaseURL      string
	DecisionPath string
	Headers      map[string]string
	Client       *http.Client
	Timeout      time.Duration
	ResultKey    string
}

Config configures the OPA adapter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL