Provide username in log data on auth failure
This commit is contained in:
parent
8d827f98da
commit
8d3d5c068c
3 changed files with 87 additions and 26 deletions
|
@ -63,6 +63,19 @@ func (d *digestAuth) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||
|
||||
username, authinfo := d.auth.CheckAuth(req)
|
||||
if username == "" {
|
||||
headerField := d.headerField
|
||||
if d.headerField == "" {
|
||||
headerField = "Authorization"
|
||||
}
|
||||
|
||||
auth := goauth.DigestAuthParams(req.Header.Get(headerField))
|
||||
if auth["username"] != "" {
|
||||
logData := accesslog.GetLogData(req)
|
||||
if logData != nil {
|
||||
logData.Core[accesslog.ClientUsername] = auth["username"]
|
||||
}
|
||||
}
|
||||
|
||||
if authinfo != nil && *authinfo == "stale" {
|
||||
logger.Debug("Digest authentication failed, possibly because out of order requests")
|
||||
tracing.SetErrorWithEvent(req, "Digest authentication failed, possibly because out of order requests")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue