1
0
Fork 0
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:
Knut Ahlers 2018-02-04 13:00:33 +01:00
parent ae4b6a7f2c
commit 62985b6c66
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -60,14 +60,18 @@ func (a authToken) DetectUser(res http.ResponseWriter, r *http.Request) (string,
tmp := strings.SplitN(authHeader, " ", 2) tmp := strings.SplitN(authHeader, " ", 2)
suppliedToken := tmp[1] suppliedToken := tmp[1]
var user, token string var (
user, token string
userFound bool
)
for user, token = range a.Tokens { for user, token = range a.Tokens {
if token == suppliedToken { if token == suppliedToken {
userFound = true
break break
} }
} }
if user == "" { if !userFound {
return "", nil, errNoValidUserFound return "", nil, errNoValidUserFound
} }