show appropriate message once browser auth is triggered
This commit is contained in:
parent
6b024dd763
commit
c2e54e8850
9
auth.go
9
auth.go
|
@ -82,7 +82,14 @@ func (auth *StaticAuth) Validate(wr http.ResponseWriter, req *http.Request) bool
|
||||||
token := hdr_parts[1]
|
token := hdr_parts[1]
|
||||||
ok := (subtle.ConstantTimeCompare([]byte(token), []byte(auth.token)) == 1)
|
ok := (subtle.ConstantTimeCompare([]byte(token), []byte(auth.token)) == 1)
|
||||||
if ok {
|
if ok {
|
||||||
return true
|
if auth.hiddenDomain != "" &&
|
||||||
|
(subtle.ConstantTimeCompare([]byte(req.Host), []byte(auth.hiddenDomain)) == 1 ||
|
||||||
|
subtle.ConstantTimeCompare([]byte(req.URL.Host), []byte(auth.hiddenDomain)) == 1) {
|
||||||
|
http.Error(wr, "Browser auth triggered!", http.StatusGone)
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
requireBasicAuth(wr, req, auth.hiddenDomain)
|
requireBasicAuth(wr, req, auth.hiddenDomain)
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue