mirror of
https://github.com/Luzifer/nginx-sso.git
synced 2024-12-20 12:51:17 +00:00
Fix: Token auth always had a logged in user
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
ae4b6a7f2c
commit
62985b6c66
1 changed files with 6 additions and 2 deletions
|
@ -60,14 +60,18 @@ func (a authToken) DetectUser(res http.ResponseWriter, r *http.Request) (string,
|
|||
tmp := strings.SplitN(authHeader, " ", 2)
|
||||
suppliedToken := tmp[1]
|
||||
|
||||
var user, token string
|
||||
var (
|
||||
user, token string
|
||||
userFound bool
|
||||
)
|
||||
for user, token = range a.Tokens {
|
||||
if token == suppliedToken {
|
||||
userFound = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if user == "" {
|
||||
if !userFound {
|
||||
return "", nil, errNoValidUserFound
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue