add prevalidateduser call to auth module- should be refactored
This commit is contained in:
parent
524f9c3082
commit
795a8e0399
2 changed files with 9 additions and 0 deletions
|
@ -8,6 +8,9 @@ import (
|
|||
|
||||
// Auther is a generic interface to implement password-based authentication and authorization
|
||||
type Auther interface {
|
||||
// PreAuthenticatedUser looks up the user for a given username, and returns a user if one is found.
|
||||
PreAuthenticatedUser(username) (*User, error)
|
||||
|
||||
// Authenticate checks username and password and returns a user if correct. The method
|
||||
// returns in constant-ish time, regardless of whether the user exists or the password is
|
||||
// correct or incorrect.
|
||||
|
|
|
@ -98,6 +98,12 @@ func NewSQLiteAuth(filename string, defaultRead, defaultWrite bool) (*SQLiteAuth
|
|||
}, nil
|
||||
}
|
||||
|
||||
// PreAuthenticatedUser looks up a user based on name- no validation of credentials is done!
|
||||
func (a *SQLiteAuth) Authenticate(username) (*User, error) {
|
||||
user, err := a.User(username)
|
||||
return user, nil
|
||||
}
|
||||
|
||||
// Authenticate checks username and password and returns a user if correct. The method
|
||||
// returns in constant-ish time, regardless of whether the user exists or the password is
|
||||
// correct or incorrect.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue