enforcement

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryPolicy

type BinaryPolicy bool

BinaryPolicy will make client-id either completely required or completely optional.

func (BinaryPolicy) OnExtraction

func (enforced BinaryPolicy) OnExtraction(ctx context.Context, err error) error

func (BinaryPolicy) OnRetrieval

func (enforced BinaryPolicy) OnRetrieval(ctx context.Context, err error) error

func (BinaryPolicy) OnValidation

func (enforced BinaryPolicy) OnValidation(ctx context.Context, err error) error

type Policy

type Policy interface {
	// OnExtraction is run after the identifier is extracted from the request
	OnExtraction(context.Context, error) error

	// OnRetrieval is run after searching for the identifier in the specificed store
	OnRetrieval(context.Context, error) error

	// OnValidation is run after all specified validation steps is run on the found client id
	OnValidation(context.Context, error) error
}

Policy which decides on how errors should be enforced by the middleware. The policy can decide if no error should be returned, or to decorate problems with specific comments that might help the API consumer.

var Default Policy = BinaryPolicy(false)

Default policy is making client id completely optional.

Jump to

Keyboard shortcuts

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