authorizer

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 29 modules, 15 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package authorizer provides authorization handlers to the server.

Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the github.com/open-policy-agent/opa/v1 package instead. See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decision added in v0.10.0

func Decision(ref func() ast.Ref) func(*Basic)

Decision returns an argument that sets the path of the authorization decision to query.

func EnablePrintStatements added in v0.35.0

func EnablePrintStatements(yes bool) func(r *Basic)

EnablePrintStatements enables print() calls. If this option is not provided, print() calls will be erased from the policy. This option only applies to queries and policies that passed as raw strings, i.e., this function will not have any affect if the caller supplies the ast.Compiler instance.

func GetBodyOnContext added in v0.25.2

func GetBodyOnContext(ctx context.Context) (any, bool)

GetBodyOnContext returns the parsed input from the request context if it exists. The authorizer saves the parsed input on the context when it runs.

func InterQueryCache added in v0.37.0

func InterQueryCache(interQueryCache cache.InterQueryCache) func(*Basic)

InterQueryCache enables the inter-query cache on the authorizer

func InterQueryValueCache added in v0.69.0

func InterQueryValueCache(interQueryValueCache cache.InterQueryValueCache) func(*Basic)

InterQueryValueCache enables the inter-query value cache on the authorizer

func NewBasic

func NewBasic(inner http.Handler, compiler func() *ast.Compiler, store storage.Store, opts ...func(*Basic)) http.Handler

NewBasic returns a new Basic object.

func PrintHook added in v0.35.0

func PrintHook(printHook print.Hook) func(*Basic)

PrintHook sets the object to use for handling print statement outputs.

func Runtime added in v0.10.0

func Runtime(term *ast.Term) func(*Basic)

Runtime returns an argument that sets the runtime on the authorizer.

func SetBodyOnContext added in v0.25.2

func SetBodyOnContext(ctx context.Context, x any) context.Context

SetBodyOnContext adds the parsed input value to the context. This function is only exposed for test purposes.

func V2Compatible added in v1.23.0

func V2Compatible(yes bool) func(*Basic)

V2Compatible enables v2-compatible request-body error responses on the authorizer. Oversized request bodies return HTTP 413 instead of HTTP 400.

Types

type Basic

type Basic = v1.Basic

Basic provides policy-based authorization over incoming requests.

Jump to

Keyboard shortcuts

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