Documentation ¶
Overview ¶
Package auth provides authentication based on http basic auth differen backend can be used
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface { Handler(http.HandlerFunc) http.HandlerFunc GinHandler() gin.HandlerFunc }
Authenticator provides handler funcs
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend provides basic HTTP Auth against a AuthBackend
func New ¶
New creates a new BasicAuth authenticator with sever and base DN user must be in one of the authGroups to be successfully authenticated
func (Backend) Gin ¶ added in v0.2.1
func (b Backend) Gin() gin.HandlerFunc
Gin is a handler func that does the authentification for GIN
func (Backend) Handler ¶
func (b Backend) Handler(next http.HandlerFunc) http.HandlerFunc
Handler is a handler func that does the authentification for stdlib http
type Backender ¶
type Backender interface {
Authenticate(user string, password string, authGroups []string) (bool, error)
}
Backender defines the interface to the auth backends
type Option ¶
type Option func(*Backend)
Option is a func to configure basic auth
func WithFailMsg ¶
WithFailMsg sets a custom message on auth failure
func WithInMemory ¶
WithInMemory is a convience function to add a in memory authentication