extractor

package
v0.0.0-...-a0e7801 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrValueNotFound = errors.New("extraction value not found")

Functions

This section is empty.

Types

type Check

type Check struct {
	User     string
	Relation string
	Object   string
	Context  map[string]any
}

type Config

type Config any

func GetExtractorConfig

func GetExtractorConfig(name string) (Config, error)

type Extraction

type Extraction struct {
	Value   string
	Context map[string]any
}

type Extractor

type Extractor func(ctx context.Context, value *authv3.CheckRequest) (Extraction, bool, error)

Extractor is the interface for extracting values from a CheckRequest.

func MakeExtractor

func MakeExtractor(name string, cfg Config) (Extractor, error)

func NewHeader

func NewHeader(config *HeaderConfig) Extractor

func NewMock

func NewMock(cfg *MockConfig) Extractor

func NewRequestMethod

func NewRequestMethod(any) Extractor

func NewSpiffe

func NewSpiffe(config *SpiffeConfig) Extractor

type ExtractorKit

type ExtractorKit struct {
	Name     string
	User     Extractor
	Object   Extractor
	Relation Extractor
}

func (ExtractorKit) Extract

func (ek ExtractorKit) Extract(ctx context.Context, req *authv3.CheckRequest) (*Check, error)

type HeaderConfig

type HeaderConfig struct {
	Name string `mapstructure:"name"`
}

func (*HeaderConfig) UnmarshalMap

func (c *HeaderConfig) UnmarshalMap(data any) error

type MockConfig

type MockConfig struct {
	Value   string         `mapstructure:"value"`
	Context map[string]any `mapstructure:"context"`
	Err     error          `mapstructure:"error"`
}

type SpiffeConfig

type SpiffeConfig struct {
	Type spiffeExtractionType `mapstructure:"type"`
}

Jump to

Keyboard shortcuts

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