Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseHTPasswd ¶
ParseHTPasswd parses the contents of htpasswd. This will read all the entries in the file, whether or not they are needed. An error is returned if a syntax errors are encountered or if the reader fails. Cherry-picked and modified from https://github.com/distribution/distribution/blob/v2.7.1/registry/auth/htpasswd/htpasswd.go
Types ¶
type Authenticator ¶
type Authenticator struct { Logger []io.Writer //log writer set // contains filtered or unexported fields }
Authenticator is auth.Provider implementation for basic authentication.
func NewBasicAuth ¶
func NewBasicAuth(cred string, logger ...io.Writer) (*Authenticator, error)
NewBasicAuth generates new filter instance for basic authentication.
func (*Authenticator) Authenticate ¶
func (b *Authenticator) Authenticate(handler http.HandlerFunc, _ ...string) http.HandlerFunc
func (Authenticator) Log ¶
func (b Authenticator) Log(logLine string)
Log provides internal logging mechanism for Authenticator
func (*Authenticator) RouterAuthenticate ¶
func (b *Authenticator) RouterAuthenticate(handle httprouter.Handle, _ ...string) httprouter.Handle
RouterAuthenticate handles authentication process via Basic authentication. If any unauthorized access, it sends WWW-RouterAuthenticate header for the client and terminate the session.