enforcer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Set is used by wire.

Functions

This section is empty.

Types

type Enforcer

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

Enforcer applies a rule-set to protobuf messages.

func ProvideEnforcer

func ProvideEnforcer(logger *log.Logger, tokens token.TokensServer) *Enforcer

ProvideEnforcer is used by wire.

func (*Enforcer) Check

func (e *Enforcer) Check(ctx context.Context, rule *capabilities.Rule) (bool, error)

Check returns true if the rule can be satisfied solely by the context.

func (*Enforcer) Enforce

func (e *Enforcer) Enforce(
	ctx context.Context, dir capabilities.Direction, val protoreflect.Value,
) (bool, error)

Enforce modifies the given message in-place in order to conform to the embedded rule-set. The method returns true if the message already complied with the rule-set (i.e. no modifications were made).

Jump to

Keyboard shortcuts

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