Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( HeaderAuthnCredentials = "authorization" HeaderAuthnEngine = "x-authorization-engine" HeaderAuthnWorkspace = "x-authorization-workspace" )
View Source
var ( ErrMalformedCredentials = errors.New("AUTHENTICATOR.MALFORMED_CREDENTIALS") ErrMalformedScheme = errors.New("AUTHENTICATOR.MALFORMED_SCHEME") ErrMalformedToken = errors.New("AUTHENTICATOR.MALFORMED_TOKEN") ErrMalformedTokenPayload = errors.New("AUTHENTICATOR.MALFORMED_TOKEN_PAYLOAD") ErrInvalidCredentials = errors.New("AUTHENTICATOR.INVALID_CREDENTIALS") )
View Source
var EngineAsk = "ask"
View Source
var EngineExternal = "external"
View Source
var (
SchemeBasic = "basic"
)
Functions ¶
Types ¶
type Account ¶
type Account struct { Sub string `json:"sub" yaml:"sub"` Name string `json:"name" yaml:"name"` Metadata map[string]string `json:"metadata" yaml:"metadata"` }
Account is followed the document of https://www.iana.org/assignments/jwt/jwt.xhtml#claims
type Ask ¶
type Authenticator ¶
type Authenticator interface { Engines() []string Register(engine string, verifier Verifier) error Authenticate(engine string, ctx context.Context, request *Request) (*Account, error) }
func New ¶
func New(conf []Config, logger logging.Logger, send sender.Send, cb circuitbreaker.CircuitBreaker) (Authenticator, error)
type Config ¶
type External ¶
type External struct { Uri string `json:"uri" yaml:"uri" mapstructure:"uri"` Headers []string `json:"headers" yaml:"headers" mapstructure:"headers"` Mapper *ExternalMapper `json:"mapper" yaml:"mapper" mapstructure:"mapper"` }
type ExternalMapper ¶
type ExternalMapper struct {
Uri string `json:"uri" yaml:"uri" mapstructure:"uri"`
}
func (*ExternalMapper) Validate ¶
func (conf *ExternalMapper) Validate() error
type Verifier ¶
func NewExternal ¶
func NewExternal(conf *External, logger logging.Logger, send sender.Send, cb circuitbreaker.CircuitBreaker) (Verifier, error)
Click to show internal directories.
Click to hide internal directories.