validator

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Kind is the kind of Validator.
	Kind = "Validator"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTValidator

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

JWTValidator defines the JWT validator

func NewJWTValidator

func NewJWTValidator(spec *JWTValidatorSpec) *JWTValidator

NewJWTValidator creates a new JWT validator

func (*JWTValidator) Validate

func (v *JWTValidator) Validate(req context.HTTPRequest) error

Validate validates the JWT token of a http request

type JWTValidatorSpec

type JWTValidatorSpec struct {
	Algorithm string `yaml:"algorithm" jsonschema:"enum=HS256,enum=HS384,enum=HS512"`
	// Secret is in hex encoding
	Secret string `yaml:"secret" jsonschema:"required,pattern=^[A-Fa-f0-9]+$"`
	// CookieName specifies the name of a cookie, if not empty, and the cookie with
	// this name both exists and has a non-empty value, its value is used as token
	// string, the Authorization header is used to get the token string otherwise.
	CookieName string `yaml:"cookieName" jsonschema:"omitempty"`
}

JWTValidatorSpec defines the configuration of JWT validator

type OAuth2JWT

type OAuth2JWT struct {
	Algorithm string `yaml:"algorithm" jsonschema:"enum=HS256,enum=HS384,enum=HS512"`
	// Secret is in hex encoding
	Secret string `yaml:"secret" jsonschema:"required,pattern=^[A-Fa-f0-9]+$"`
	// contains filtered or unexported fields
}

OAuth2JWT defines the validator configuration for OAuth2 self encoded access token

type OAuth2TokenIntrospect

type OAuth2TokenIntrospect struct {
	EndPoint     string `yaml:"endPoint" jsonschema:"required"`
	BasicAuth    string `yaml:"basicAuth" jsonschema:"omitempty"`
	ClientID     string `yaml:"clientId" jsonschema:"omitempty"`
	ClientSecret string `yaml:"clientSecret" jsonschema:"omitempty"`
	InsecureTLS  bool   `yaml:"insecureTls"`
}

OAuth2TokenIntrospect defines the validator configuration for OAuth2 token introspection

type OAuth2Validator

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

OAuth2Validator defines the OAuth2 validator

func NewOAuth2Validator

func NewOAuth2Validator(spec *OAuth2ValidatorSpec) *OAuth2Validator

NewOAuth2Validator creates a new OAuth2 validator

func (*OAuth2Validator) Validate

func (v *OAuth2Validator) Validate(req context.HTTPRequest) error

Validate validates the access token of a http request

type OAuth2ValidatorSpec

type OAuth2ValidatorSpec struct {
	TokenIntrospect *OAuth2TokenIntrospect `yaml:"tokenIntrospect" jsonschema:"omitempty"`
	JWT             *OAuth2JWT             `yaml:"jwt" jsonschema:"omitempty"`
}

OAuth2ValidatorSpec defines the configuration of OAuth2 validator

type Spec

type Spec struct {
	Headers   *httpheader.ValidatorSpec `yaml:"headers,omitempty" jsonschema:"omitempty"`
	JWT       *JWTValidatorSpec         `yaml:"jwt,omitempty" jsonschema:"omitempty"`
	Signature *signer.Spec              `yaml:"signature,omitempty" jsonschema:"omitempty"`
	OAuth2    *OAuth2ValidatorSpec      `yaml:"oauth2,omitempty" jsonschema:"omitempty"`
}

Spec describes the Validator.

type Validator

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

Validator is filter Validator.

func (*Validator) Close

func (v *Validator) Close()

Close closes Validator.

func (*Validator) DefaultSpec

func (v *Validator) DefaultSpec() interface{}

DefaultSpec returns default spec of Validator.

func (*Validator) Description

func (v *Validator) Description() string

Description returns the description of Validator.

func (*Validator) Handle

func (v *Validator) Handle(ctx context.HTTPContext) string

Handle validates HTTPContext.

func (*Validator) Inherit

func (v *Validator) Inherit(filterSpec *httppipeline.FilterSpec, previousGeneration httppipeline.Filter)

Inherit inherits previous generation of Validator.

func (*Validator) Init

func (v *Validator) Init(filterSpec *httppipeline.FilterSpec)

Init initializes Validator.

func (*Validator) Kind

func (v *Validator) Kind() string

Kind returns the kind of Validator.

func (*Validator) Results

func (v *Validator) Results() []string

Results returns the results of Validator.

func (*Validator) Status

func (v *Validator) Status() interface{}

Status returns status.

Jump to

Keyboard shortcuts

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