mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-13 22:36:27 +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); {
|
||||
subdir := h.Val()
|
||||
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":
|
||||
if !h.Args(&cp.ClientAuthentication.Mode) {
|
||||
return nil, h.ArgErr()
|
||||
|
|
Loading…
Reference in a new issue