Remove useless field
This commit is contained in:
parent
226c444d94
commit
5b0898c8e8
3 changed files with 2 additions and 8 deletions
|
|
@ -58,7 +58,6 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
|||
h.AuthCredentials = [][]byte{}
|
||||
}
|
||||
h.AuthCredentials = append(h.AuthCredentials, EncodeAuthCredentials(args[0], args[1]))
|
||||
h.AuthRequired = true
|
||||
case "hosts":
|
||||
if len(args) == 0 {
|
||||
return d.ArgErr()
|
||||
|
|
|
|||
|
|
@ -204,7 +204,6 @@ func TestMain(m *testing.M) {
|
|||
PACPath: defaultPACPath,
|
||||
ACL: []ACLRule{{Subjects: []string{"all"}, Allow: true}},
|
||||
AuthCredentials: [][]byte{EncodeAuthCredentials("test", "pass")},
|
||||
AuthRequired: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +214,6 @@ func TestMain(m *testing.M) {
|
|||
PACPath: defaultPACPath,
|
||||
ACL: []ACLRule{{Subjects: []string{"all"}, Allow: true}},
|
||||
AuthCredentials: [][]byte{EncodeAuthCredentials("test", "pass")},
|
||||
AuthRequired: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -228,7 +226,6 @@ func TestMain(m *testing.M) {
|
|||
ACL: []ACLRule{{Subjects: []string{"all"}, Allow: true}},
|
||||
ProbeResistance: &ProbeResistance{Domain: "test.localhost"},
|
||||
AuthCredentials: [][]byte{EncodeAuthCredentials("test", "pass")},
|
||||
AuthRequired: true,
|
||||
},
|
||||
httpRedirPort: "8880",
|
||||
}
|
||||
|
|
@ -257,7 +254,6 @@ func TestMain(m *testing.M) {
|
|||
proxyHandler: &Handler{
|
||||
Upstream: "https://test:pass@127.0.0.1:4891",
|
||||
AuthCredentials: [][]byte{EncodeAuthCredentials("upstreamtest", "upstreampass")},
|
||||
AuthRequired: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ type Handler struct {
|
|||
aclRules []aclRule
|
||||
|
||||
// TODO: temporary/deprecated - we should try to reuse existing authentication modules instead!
|
||||
AuthRequired bool `json:"auth_required,omitempty"`
|
||||
AuthCredentials [][]byte `json:"auth_credentials,omitempty"` // slice with base64-encoded credentials
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +145,7 @@ func (h *Handler) Provision(ctx caddy.Context) error {
|
|||
h.aclRules = append(h.aclRules, &aclAllRule{allow: true})
|
||||
|
||||
if h.ProbeResistance != nil {
|
||||
if !h.AuthRequired {
|
||||
if h.AuthCredentials == nil {
|
||||
return fmt.Errorf("probe resistance requires authentication")
|
||||
}
|
||||
if len(h.ProbeResistance.Domain) > 0 {
|
||||
|
|
@ -228,7 +227,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyht
|
|||
}
|
||||
|
||||
var authErr error
|
||||
if h.AuthRequired {
|
||||
if h.AuthCredentials != nil {
|
||||
authErr = h.checkCredentials(r)
|
||||
}
|
||||
if h.ProbeResistance != nil && len(h.ProbeResistance.Domain) > 0 && reqHost == h.ProbeResistance.Domain {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue