mirror of
https://github.com/therootcompany/golib.git
synced 2026-03-02 23:57:59 +00:00
fix(auth/csvauth): don't allow BOTH username and password to be empty
This commit is contained in:
parent
3465e9e232
commit
1789c92815
@ -358,6 +358,10 @@ func (a *Auth) gcmDecrypt(aes128key [16]byte, gcmNonce [12]byte, derived []byte)
|
|||||||
// - the resulting 'user' must match BasicAuthTokenNames ("", "api", and "apikey" are the defaults)
|
// - the resulting 'user' must match BasicAuthTokenNames ("", "api", and "apikey" are the defaults)
|
||||||
// - then the token is (timing-safe) hashed to check if it exists, and then verified by its algorithm
|
// - then the token is (timing-safe) hashed to check if it exists, and then verified by its algorithm
|
||||||
func (a *Auth) Authenticate(name, secret string) (*Credential, error) {
|
func (a *Auth) Authenticate(name, secret string) (*Credential, error) {
|
||||||
|
if name == "" && secret == "" {
|
||||||
|
return nil, ErrUnauthorized
|
||||||
|
}
|
||||||
|
|
||||||
a.mux.Lock()
|
a.mux.Lock()
|
||||||
defer a.mux.Unlock()
|
defer a.mux.Unlock()
|
||||||
c, ok := a.credentials[name]
|
c, ok := a.credentials[name]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user