opa

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Server mode configuration (recommended for production)
	ServerURL    string `yaml:"server_url" json:"server_url" mapstructure:"server_url"`          // OPA Server address, e.g., http://opa-server:8181
	DecisionPath string `yaml:"decision_path" json:"decision_path" mapstructure:"decision_path"` // Decision path, e.g., /v1/data/http/authz/allow
	TimeoutMs    int    `yaml:"timeout_ms" json:"timeout_ms" mapstructure:"timeout_ms"`          // Request timeout in milliseconds, default 100
	BearerToken  string `yaml:"bearer_token" json:"bearer_token" mapstructure:"bearer_token"`    // Optional authentication token

	// Embedded mode configuration (for backward compatibility)
	Policy     string `yaml:"policy" json:"policy" mapstructure:"policy"`             // Policy content
	Entrypoint string `yaml:"entrypoint" json:"entrypoint" mapstructure:"entrypoint"` // Policy entrypoint
}

type Filter

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

func (*Filter) Decode

Decode is the core logic of the filter. It converts HTTP request data into a standard OPA input format and evaluates the policy.

type FilterFactory

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

func (*FilterFactory) Apply

func (factory *FilterFactory) Apply() error

Apply is called after the configuration is loaded and is used to prepare the OPA query.

func (*FilterFactory) Config

func (factory *FilterFactory) Config() any

func (*FilterFactory) PrepareFilterChain

func (factory *FilterFactory) PrepareFilterChain(ctx *contextHttp.HttpContext, chain filter.FilterChain) error

PrepareFilterChain prepares the filter chain for a new request by dynamically creating a Filter

type Plugin

type Plugin struct{}

func (*Plugin) CreateFilterFactory

func (p *Plugin) CreateFilterFactory() (filter.HttpFilterFactory, error)

func (*Plugin) Kind

func (p *Plugin) Kind() string

Jump to

Keyboard shortcuts

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