mirror of
https://github.com/therootcompany/golib.git
synced 2026-03-13 12:27:59 +00:00
ref(auth/csvauth): don't hold mutex longer than necessary
This commit is contained in:
parent
020b00c353
commit
c32acd5a74
@ -363,9 +363,10 @@ func (a *Auth) Authenticate(name, secret string) (auth.BasicPrinciple, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a.mux.Lock()
|
a.mux.Lock()
|
||||||
defer a.mux.Unlock()
|
|
||||||
nameID := a.nameCacheID(name)
|
nameID := a.nameCacheID(name)
|
||||||
c, ok := a.hashedCredentials[nameID]
|
c, ok := a.hashedCredentials[nameID]
|
||||||
|
a.mux.Unlock()
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
if err := c.Verify(name, secret); err != nil {
|
if err := c.Verify(name, secret); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user