Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Token string `yaml:"token"`
}
AuthConfig is the configuration for authenticators
type Authenticator ¶
type Authenticator interface {
Authenticate(context.Context, map[string][]string) (context.Context, error)
}
Authenticator allows specifying the authentication strategy
func FindAuthenticator ¶
func FindAuthenticator(n string, c AuthConfig) (Authenticator, error)
FindAuthenticator find the appropriate authenticator based on the specified name
type BearerTokenAuth ¶
type BearerTokenAuth struct {
// contains filtered or unexported fields
}
BearerTokenAuth performs authentication with a bearer token
func (BearerTokenAuth) Authenticate ¶
func (b BearerTokenAuth) Authenticate(ctx context.Context, h map[string][]string) (context.Context, error)
Authenticate checks the request against bearer token authentication
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds all the config available for a server
type ConfigOption ¶
type ConfigOption func(*Config)
ConfigOption allows passing a functional option when creating a new server
func WithAddr ¶
func WithAddr(a string) ConfigOption
WithAddr specifies the address the server will listen on
func WithAuthenticator ¶
func WithAuthenticator(a Authenticator) ConfigOption
WithAuthenticator allows specifying the authenticator
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an `http.Server` which knows how to serve our requests
func NewServer ¶
func NewServer(dic *dictionary.Dictionary, opts ...ConfigOption) *Server
NewServer creates a new instance of server
func (*Server) ListenAndServe ¶
ListenAndServe starts the HTTP server and blocks until it finished running