cedar

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 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 cedar implements authorization.Authorizer with the Cedar policy language (github.com/cedar-policy/cedar-go).

For every request the Engine reads the policy text and the request-scoped entity JSON from its sources, so policy changes take effect immediately and no state is cached. Inputs are bounded (1 MiB of policies, 1 MiB of entities, entity identifiers, context depth and size) and validated; duplicate or invalid entity UIDs, mixed-type context sets and unsupported context value types are rejected. Evaluation is default-deny: a decision is allowed only when a permit policy matches, no forbid policy matches and no policy failed to evaluate. Diagnostic reasons and errors list policy IDs only, in deterministic order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine evaluates Cedar policies against request-scoped entities. It is safe for concurrent use when its sources are.

func New

func New(options Options) (*Engine, error)

New validates the required policy and entity sources.

func (*Engine) Authorize

func (e *Engine) Authorize(ctx context.Context, request authorization.Request) (authorization.Decision, error)

Authorize evaluates one request. Every ambiguous or invalid input fails closed with an error from package authorization. Request.Context accepts bool, string, int64, []string, []any and map[string]any values.

type Options

type Options struct {
	Policies authorization.PolicySource
	Entities authorization.EntitySource
}

Options configures an Engine.

Jump to

Keyboard shortcuts

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