Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthSource ¶
AuthSource is the interface the middleware uses to retrieve password hashes. The provided SimpleSource takes a single username/password combination and returns the password's hash when the username is provided. A more complex implementation could use a database or external service to provide password hashes for usernames. A nil result indicates that the user with the given name was not found.
type SimpleSource ¶
type SimpleSource struct {
// contains filtered or unexported fields
}
SimpleSource takes a single username/password combination and provides an AuthSource that returns the password's hash when the username is provided. All other usernames will return a non-nil error.
func NewSimpleSource ¶
func NewSimpleSource(username, password string, cost int) (*SimpleSource, error)
NewSimpleSource constructs a SimpleSource from the given username and password.
func (*SimpleSource) LookupHash ¶
func (s *SimpleSource) LookupHash(_ context.Context, username string) []byte
LookupHash implements the AuthSource interface