Documentation ¶
Index ¶
- Constants
- type JWTValidator
- type JWTValidatorSpec
- type OAuth2JWT
- type OAuth2TokenIntrospect
- type OAuth2Validator
- type OAuth2ValidatorSpec
- type Spec
- type Validator
- func (v *Validator) Close()
- func (v *Validator) DefaultSpec() interface{}
- func (v *Validator) Description() string
- func (v *Validator) Handle(ctx context.HTTPContext) string
- func (v *Validator) Inherit(filterSpec *httppipeline.FilterSpec, previousGeneration httppipeline.Filter)
- func (v *Validator) Init(filterSpec *httppipeline.FilterSpec)
- func (v *Validator) Kind() string
- func (v *Validator) Results() []string
- func (v *Validator) Status() interface{}
Constants ¶
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) DefaultSpec ¶
func (v *Validator) DefaultSpec() interface{}
DefaultSpec returns default spec of Validator.
func (*Validator) Description ¶
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.