Documentation
¶
Overview ¶
Package pwdauth provides an authentication service plugin that allows users to authenticate via a email and password.
Index ¶
Constants ¶
const ( PluginName = "auth_pwdauth" ProviderName = "password" )
Variables ¶
var DefaultHasher = bcryptHasher{}
DefaultHasher calls golang's standard bcrypt functions to hash and compare passwords.
var TestHasher = testHasher{}
TestHasher is a Hasher that does not hash passwords. It is useful for testing purposes.
Functions ¶
This section is empty.
Types ¶
type Account ¶
Account contains minimal information needed by the pwdauth plugin to authenticate a user. The application should map it's own user model to this via the AccountFinder interface.
type AccountFinder ¶
type Hasher ¶
type Hasher interface { // Generate a hashed password from a plaintext password. Generate(password []byte) ([]byte, error) // Compare a hashed password with a plaintext password. Compare(hashedPassword, password []byte) error }
Interface that allows password hashing to be customized.
type PwdAuthOption ¶
type PwdAuthOption func(*PwdAuthPlugin)
PwdAuthOption allows configuration of the PwdAuthPlugin.
func WithAccountFinder ¶
func WithAccountFinder(f AccountFinder) PwdAuthOption
WithAccountFinder tells the pwdauth plugin how to find user accounts.
func WithHasher ¶
func WithHasher(h Hasher) PwdAuthOption
WithHasher overrides the default hasher used by the PwdAuthPlugin.
type PwdAuthPlugin ¶
type PwdAuthPlugin struct {
// contains filtered or unexported fields
}
func Plugin ¶
func Plugin(opts ...PwdAuthOption) *PwdAuthPlugin
Plugin for handling password based authentication.