Documentation ¶
Index ¶
- Constants
- type AuthorizedUsersCache
- type BasicAuthValidator
- type BasicAuthValidatorSpec
- 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 AuthorizedUsersCache ¶ added in v1.5.0
AuthorizedUsersCache provides cached lookup for authorized users.
type BasicAuthValidator ¶ added in v1.5.0
type BasicAuthValidator struct {
// contains filtered or unexported fields
}
BasicAuthValidator defines the Basic Auth validator
func NewBasicAuthValidator ¶ added in v1.5.0
func NewBasicAuthValidator(spec *BasicAuthValidatorSpec, supervisor *supervisor.Supervisor) *BasicAuthValidator
NewBasicAuthValidator creates a new Basic Auth validator
func (*BasicAuthValidator) Close ¶ added in v1.5.0
func (bav *BasicAuthValidator) Close()
Close closes authorizedUsersCache.
func (*BasicAuthValidator) Validate ¶ added in v1.5.0
func (bav *BasicAuthValidator) Validate(req httpcontext.HTTPRequest) error
Validate validates the Authorization header of a http request
type BasicAuthValidatorSpec ¶ added in v1.5.0
type BasicAuthValidatorSpec struct { Mode string `yaml:"mode" jsonschema:"omitempty,enum=FILE,enum=ETCD"` // Required for 'FILE' mode. // UserFile is path to file containing encrypted user credentials in apache2-utils/htpasswd format. // To add user `userY`, use `sudo htpasswd /etc/apache2/.htpasswd userY` // Reference: https://manpages.debian.org/testing/apache2-utils/htpasswd.1.en.html#EXAMPLES UserFile string `yaml:"userFile" jsonschema:"omitempty"` // Required for 'ETCD' mode. // When EtcdPrefix is specified, verify user credentials from etcd. Etcd should store them: // key: /custom-data/{etcdPrefix}/{$key} // value: // key: "$key" // username: "$username" # optional // password: "$password" // Username and password are used for Basic Authentication. If "username" is empty, the value of "key" // entry is used as username for Basic Auth. EtcdPrefix string `yaml:"etcdPrefix" jsonschema:"omitempty"` }
BasicAuthValidatorSpec defines the configuration of Basic Auth validator. There are 'file' and 'etcd' modes.
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"` BasicAuth *BasicAuthValidatorSpec `yaml:"basicAuth,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.