Documentation
¶
Index ¶
Constants ¶
const Version = "0.1.0"
Version defines the current package semantic version.
Variables ¶
This section is empty.
Functions ¶
func DecodeBasicAuthHeader ¶
DecodeBasicAuthHeader decodes a given string as HTTP basic auth scheme.
Types ¶
type BasicAuth ¶
type BasicAuth struct {
User, Password string
}
BasicAuth represents the user-password pair used as helper struct.
type Config ¶
type Config struct {
// RealM token used for unauthorized
RealM string
// Tokens stores a list of allowed authorization tokens.
// Tokens could be of any type.
Tokens []Token
// Matchers stores a list of matchers used to compare an incoming
// authorization header againts the registered allowed tokens.
Matchers []Matcher
}
Config represents the authorization middleware configuration.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler authentication middleware handler.
func New ¶
New creates a new authorization middleware handler with the given config.
func Tokens ¶
Tokens creates a new auth handler allowing the given token strings. Tokens must be transported via Authorization header.
func User ¶
User function is optional but handy, used to check input parameters when creating new middlewares
func Users ¶
Users creates a new auth middleware allowing access to the list of users.
type Matcher ¶
Matcher represents the required auth header matcher function signature implemented by matchers.
type Token ¶
type Token struct {
// Type stores the authorization type. Usually Basic or Bearer.
Type string
// Value stores the authorization token.
// If the authorization token has no type, this field will be filled instead.
Value string
}
Token represents the parsed schema of an HTTP authorization header.
Source Files
¶
- auth.go
- basic.go
- version.go
