cel

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CelAuthorizer

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

CelAuthorizer is a Common Expression Language vm that uses CEL expressions to authorize grpc requests

func NewCelAuthorizer

func NewCelAuthorizer(rules map[string]*authorize.RuleSet, opts ...Opt) (*CelAuthorizer, error)

NewCelAuthorizer returns a new CelAuthorizer. The rules map is a map of method names to RuleSets. The RuleSets are used to authorize the method. The RuleSets are evaluated in order and the first rule that evaluates to true will authorize the request. The mapping can be generated with the protoc-gen-authorize plugin.

func (*CelAuthorizer) AuthorizeMethod

func (c *CelAuthorizer) AuthorizeMethod(ctx context.Context, method string, params *authorizer.RuleExecutionParams) (bool, error)

AuthorizeMethod authorizes a gRPC method the RuleExecutionParams and returns a boolean representing whether the request is authorized or not.

type Opt added in v0.5.0

type Opt func(*CelAuthorizer)

Opt is a functional option for configuring a CelAuthorizer

func WithMacros added in v0.5.0

func WithMacros(macros ...cel.Macro) Opt

WithMacros sets additional macros that will be available to the cel vm Please note that the standard macros are already included

Jump to

Keyboard shortcuts

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