Documentation ¶
Index ¶
Constants ¶
const ClientIDField = "clientid"
ClientIDField is the name of the field in the Credentials containing the client ID
const ClientSecretField = "clientsecret"
ClientSecretField is the name of the field in the Credentials containing the client secret
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserPassAuthentication ¶
type UserPassAuthentication struct {
// contains filtered or unexported fields
}
UserPassAuthentication implements a simple username/password authentication method.
UserPassAuthentication does not store passwords in plain, but instead uses the bcrypt hashing algorithm.
Needs to be initialized properly before being used. Use the NewUserPassAuthentication function to get a new instance.
func NewUserPassAuthentication ¶
func NewUserPassAuthentication() *UserPassAuthentication
NewUserPassAuthentication creates a new instance of UserPassAuthentication
func (*UserPassAuthentication) Authenticate ¶
func (a *UserPassAuthentication) Authenticate(creds auth.Credentials) (clientID string, autherr error)
Authenticate takes the credentials in creds and tries to authenticate them.
func (*UserPassAuthentication) LoadAuthDataFromFile ¶
func (a *UserPassAuthentication) LoadAuthDataFromFile(path string) error
LoadAuthDataFromFile loads the authentication data from the file at path. File must contain username/password pairs, where both tokens must be separated by colon. Usernames must be strings of length 32, containing only hexadecimal characters. Passwords must be passwd-style bcrypt hashes and indicate bcrypt version and cost.
The file may also contain comments starting with either the '#' or '//' characters. Comments will be ignored.
Returns nil on success, or an error indicating why the file couldn't be loaded.
func (*UserPassAuthentication) UpsertUser ¶
func (a *UserPassAuthentication) UpsertUser(username, password string)
UpsertUser adds or updates a user with username and password