cedar

package
v2.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cedar adapts cedar-go policy evaluation to api-toolkit authorization ports.

Use New with a Cedar policy set when an application wants policy-backed authorization through authorization.NewPolicyAuthorizer. The adapter is in the contrib module and remains outside the stable core API promise.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecordFromMap

func RecordFromMap(input map[string]any) (cedarcore.Record, error)

RecordFromMap converts a map into a Cedar record using supported value types.

func ValueFromAny

func ValueFromAny(input any) (cedarcore.Value, error)

ValueFromAny converts a Go value into a Cedar value.

Types

type Config

type Config struct {
	Policies       cedarcore.PolicyIterator
	Entities       cedarcore.EntityGetter
	PrincipalType  string
	ResourceType   string
	ActionType     string
	RequestBuilder RequestBuilder
}

Config configures the Cedar adapter.

type Engine

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

Engine evaluates policies using cedar-go.

func New

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

New creates a new Cedar adapter.

func (*Engine) Evaluate

Evaluate evaluates a policy request.

type RequestBuilder

type RequestBuilder func(req ports.PolicyRequest) (cedarcore.Request, error)

RequestBuilder converts a policy request into a Cedar request.

Jump to

Keyboard shortcuts

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