package authorizer

import "github.com/open-policy-agent/opa/server/authorizer"

Package authorizer provides authorization handlers to the server.

Index

Functions

func Decision

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

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

func GetBodyOnContext

func GetBodyOnContext(ctx context.Context) (interface{}, 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 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 Runtime

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

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

func SetBodyOnContext

func SetBodyOnContext(ctx context.Context, x interface{}) context.Context

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

Types

type Basic

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

Basic provides policy-based authorization over incoming requests.

func (*Basic) ServeHTTP

func (h *Basic) ServeHTTP(w http.ResponseWriter, r *http.Request)

Source Files

authorizer.go

Version
v0.33.1
Published
Oct 4, 2021
Platform
js/wasm
Imports
12 packages
Last checked
4 seconds ago

Tools for package owners.