try to get the user in another way

Former-commit-id: 59ce4d47c5b9e8e338865e18f4b3f544211e70b5 [formerly 41f97baaeb88db9ca36bc36181289bf1bad520b4] [formerly 22e8fa3a47bf6f9ab930633f72efb3d24e922120 [formerly 00cbdd1833]]
Former-commit-id: 355f8669dbfc0254a11ee741058e6074c5a0cbbd [formerly 7f7857ae3c89b20799c421ce1321397e99b5700c]
Former-commit-id: d1feaf6977dfcb14d04ee2e9629249d9a1bc7814
pull/726/head
Henrique Dias 2017-04-16 13:29:57 +01:00
parent 8dc8c74a82
commit 79ad87f4d8
1 changed files with 2 additions and 2 deletions

View File

@ -51,8 +51,8 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
return http.StatusForbidden, nil
}
// Obtains the user
username, _, _ := r.BasicAuth()
// Obtains the user. See https://github.com/mholt/caddy/blob/master/caddyhttp/basicauth/basicauth.go#L66
username, _ := r.Context().Value(httpserver.RemoteUserCtxKey).(string)
if _, ok := c.Users[username]; ok {
user = c.Users[username]
} else {