policy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareConfig

func PrepareConfig(config []byte) (*preparedConfig, error)

Types

type CheckInput

type CheckInput struct {
	Uri     string
	Method  string
	Headers map[string]string
}

type CheckResult

type CheckResult struct {
	Allow      bool
	ClientName string
	Endpoint   string
	Err        error
}

type Checker

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

func NewChecker

func NewChecker() *Checker

func (*Checker) Check

func (c *Checker) Check(in CheckInput) (*CheckResult, error)

func (*Checker) Data

func (c *Checker) Data() interface{}

func (*Checker) Policy

func (c *Checker) Policy() []byte

func (*Checker) SetData

func (c *Checker) SetData(data interface{})

func (*Checker) SetPolicy

func (c *Checker) SetPolicy(policy []byte) error

type Cn

type Cn struct {
	Prefix string  `yaml:"prefix"`
	Header *string `yaml:"header"`
	JWT    *CnJWT  `yaml:"jwt"`
}

type CnJWT added in v0.4.0

type CnJWT struct {
	Payload     string  `yaml:"payload"`
	Header      *string `yaml:"header"`
	Cookie      *string `yaml:"cookie"`
	KeyFile     *string `yaml:"keyFile"`
	KeyFileData []byte
}

type Config

type Config struct {
	Cn       []Cn      `yaml:"cn"`
	Vars     Variables `yaml:"vars"`
	Default  []string  `yaml:"default"`
	Policies []Policy  `yaml:"policies"`
}

type ErrInvalidClientName added in v0.4.0

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

func (ErrInvalidClientName) Error added in v0.4.0

func (e ErrInvalidClientName) Error() string

type Policy

type Policy struct {
	Uri     []string `yaml:"uri"`
	Methods []string `yaml:"method"`
	Allow   []string `yaml:"allow"`
}

type Variables

type Variables map[string][]string

Jump to

Keyboard shortcuts

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