Documentation
¶
Overview ¶
Package auth provides HTTP authentication utilities and interfaces.
Index ¶
- func HandlerFunc(cfg *ServerConfig, origHandler http.HandlerFunc) (http.HandlerFunc, error)
- func MultiAuthnHandlerFunc(cfg *ServerConfig, origHandler http.HandlerFunc) http.HandlerFunc
- func NullHandler(next http.HandlerFunc) http.HandlerFunc
- type Authenticator
- type ClientAuth
- type ClientConfig
- type GenericAuthConfig
- type Handler
- type Middleware
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandlerFunc ¶ added in v0.37.0
func HandlerFunc(cfg *ServerConfig, origHandler http.HandlerFunc) (http.HandlerFunc, error)
HandlerFunc creates an authentication-wrapped HTTP handler function from the provided configuration.
func MultiAuthnHandlerFunc ¶ added in v0.37.0
func MultiAuthnHandlerFunc(cfg *ServerConfig, origHandler http.HandlerFunc) http.HandlerFunc
MultiAuthnHandlerFunc creates a handler function that supports multiple authentication providers.
func NullHandler ¶
func NullHandler(next http.HandlerFunc) http.HandlerFunc
NullHandler is a handler that passes through to the next handler without authentication.
Types ¶
type Authenticator ¶ added in v0.37.0
Authenticator is an interface for authenticating an HTTP request.
type ClientAuth ¶
ClientAuth is an interface for adding authentication to an HTTP request.
func NewClientAuth ¶ added in v0.53.0
func NewClientAuth(authConfig ClientConfig) ClientAuth
NewClientAuth returns a ClientAuth implementation based on the provided configuration.
type ClientConfig ¶ added in v0.37.0
type ClientConfig struct {
BasicAuthConfig basic.ClientConfig `mapstructure:"basic"`
GitHubAuthConfig github.ClientConfig `mapstructure:"github"`
HMACAuthConfig hmac.ClientConfig `mapstructure:"hmac"`
}
ClientConfig represents the authentication configuration for an HTTP client.
type GenericAuthConfig ¶ added in v0.37.0
type GenericAuthConfig struct {
Name string `mapstructure:"name"`
Config map[string]interface{} `mapstructure:"config"`
}
GenericAuthConfig represents a generic authentication configuration.
type Handler ¶ added in v0.37.0
type Handler struct {
Config ServerConfig
// contains filtered or unexported fields
}
Handler describes an HTTP authentication handler.
func NewHandler ¶ added in v0.37.0
func NewHandler(cfg *ServerConfig) (*Handler, error)
NewHandler creates a new authentication handler from the provided configuration.
type Middleware ¶ added in v0.37.0
type Middleware interface {
// AuthRequest(r *http.Request) (stdctx.Context, error)
Wrap(http.Handler) http.Handler
}
Middleware is an interface for wrapping an HTTP handler with authentication.
type ServerConfig ¶ added in v0.37.0
type ServerConfig struct {
BasicAuthConfig basic.ServerConfig `mapstructure:"basic"`
GitHubAuthConfig github.ServerConfig `mapstructure:"github"`
HMACAuthConfig hmac.ServerConfig `mapstructure:"hmac"`
Providers []string `mapstructure:"providers"`
}
ServerConfig represents the authentication configuration for an HTTP server.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package basic provides HTTP Basic authentication middleware and utilities.
|
Package basic provides HTTP Basic authentication middleware and utilities. |
|
Package context provides utilities for managing authentication information in context.
|
Package context provides utilities for managing authentication information in context. |
|
Package github provides GitHub-based authentication middleware.
|
Package github provides GitHub-based authentication middleware. |
|
Package hmac provides HMAC-based authentication middleware.
|
Package hmac provides HMAC-based authentication middleware. |
|
Package oidc provides HTTP authentication using OpenID Connect.
|
Package oidc provides HTTP authentication using OpenID Connect. |