mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-28 12:55:57 +03:00
httpcaddyfile: Support client auth verifiers (#6022)
* Added verifier case Update author * Update verifier to match struct tag * gci run
This commit is contained in:
parent
ed41c924cf
commit
cb86319bd5
1 changed files with 18 additions and 0 deletions
|
@ -219,6 +219,24 @@ func parseTLS(h Helper) ([]ConfigValue, error) {
|
||||||
for nesting := h.Nesting(); h.NextBlock(nesting); {
|
for nesting := h.Nesting(); h.NextBlock(nesting); {
|
||||||
subdir := h.Val()
|
subdir := h.Val()
|
||||||
switch subdir {
|
switch subdir {
|
||||||
|
case "verifier":
|
||||||
|
if !h.NextArg() {
|
||||||
|
return nil, h.ArgErr()
|
||||||
|
}
|
||||||
|
|
||||||
|
vType := h.Val()
|
||||||
|
modID := "tls.client_auth." + vType
|
||||||
|
unm, err := caddyfile.UnmarshalModule(h.Dispenser, modID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, ok := unm.(caddytls.ClientCertificateVerifier)
|
||||||
|
if !ok {
|
||||||
|
return nil, h.Dispenser.Errf("module %s is not a caddytls.ClientCertificatVerifier", modID)
|
||||||
|
}
|
||||||
|
|
||||||
|
cp.ClientAuthentication.VerifiersRaw = append(cp.ClientAuthentication.VerifiersRaw, caddyconfig.JSONModuleObject(unm, "verifier", vType, h.warnings))
|
||||||
case "mode":
|
case "mode":
|
||||||
if !h.Args(&cp.ClientAuthentication.Mode) {
|
if !h.Args(&cp.ClientAuthentication.Mode) {
|
||||||
return nil, h.ArgErr()
|
return nil, h.ArgErr()
|
||||||
|
|
Loading…
Reference in a new issue