Documentation ¶
Overview ¶
Package validator provides Validator filter to validates HTTP requests.
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) Handle(ctx *context.Context) string
- func (v *Validator) Inherit(previousGeneration filters.Filter)
- func (v *Validator) Init()
- func (v *Validator) Kind() *filters.Kind
- func (v *Validator) Name() string
- func (v *Validator) Spec() filters.Spec
- 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 ¶
AuthorizedUsersCache provides cached lookup for authorized users.
type BasicAuthValidator ¶
type BasicAuthValidator struct {
// contains filtered or unexported fields
}
BasicAuthValidator defines the Basic Auth validator
func NewBasicAuthValidator ¶
func NewBasicAuthValidator(spec *BasicAuthValidatorSpec, supervisor *supervisor.Supervisor) *BasicAuthValidator
NewBasicAuthValidator creates a new Basic Auth validator
func (*BasicAuthValidator) Close ¶
func (bav *BasicAuthValidator) Close()
Close closes authorizedUsersCache.
type BasicAuthValidatorSpec ¶
type BasicAuthValidatorSpec struct { Mode string `json:"mode,omitempty" jsonschema:"enum=FILE,enum=ETCD,enum=LDAP"` // 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 `json:"userFile,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 `json:"etcdPrefix,omitempty"` // Required for 'LDAP' mode. LDAP *ldapSpec `json:"ldap,omitempty" jsonshema:"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
type JWTValidatorSpec ¶
type JWTValidatorSpec struct { Algorithm string `` /* 139-byte string literal not displayed */ // PublicKey is in hex encoding PublicKey string `json:"publicKey" jsonschema:"pattern=^$|^[A-Fa-f0-9]+$"` // Secret is in hex encoding Secret string `json:"secret" jsonschema:"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 `json:"cookieName,omitempty"` }
JWTValidatorSpec defines the configuration of JWT validator
type OAuth2JWT ¶
type OAuth2JWT struct { Algorithm string `json:"algorithm" jsonschema:"enum=HS256,enum=HS384,enum=HS512"` // Secret is in hex encoding Secret string `json:"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 `json:"endPoint" jsonschema:"required"` BasicAuth string `json:"basicAuth,omitempty"` ClientID string `json:"clientId,omitempty"` ClientSecret string `json:"clientSecret,omitempty"` InsecureTLS bool `json:"insecureTls,omitempty"` }
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
type OAuth2ValidatorSpec ¶
type OAuth2ValidatorSpec struct { TokenIntrospect *OAuth2TokenIntrospect `json:"tokenIntrospect,omitempty"` JWT *OAuth2JWT `json:"jwt,omitempty"` }
OAuth2ValidatorSpec defines the configuration of OAuth2 validator
type Spec ¶
type Spec struct { filters.BaseSpec `json:",inline"` Headers *httpheader.ValidatorSpec `json:"headers,omitempty"` JWT *JWTValidatorSpec `json:"jwt,omitempty"` Signature *signer.Spec `json:"signature,omitempty"` OAuth2 *OAuth2ValidatorSpec `json:"oauth2,omitempty"` BasicAuth *BasicAuthValidatorSpec `json:"basicAuth,omitempty"` }
Spec describes the Validator.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator is filter Validator.