@marcel91200 / caddy Mirror · read-only / commits / cb86319b
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 19:30 UTC

httpcaddyfile: Support client auth verifiers (#6022)

* Added verifier case Update author * Update verifier to match struct tag * gci run

Zach Galvin committed Jan 9, 2024 at 17:14 UTC cb86319bd50322d4ac9e730b2fc5639daa24b82a
1 file changed +18
caddyconfig/httpcaddyfile/builtins.go
+18
@@ -219,6 +219,24 @@ func parseTLS(h Helper) ([]ConfigValue, error) {
219 for nesting := h.Nesting(); h.NextBlock(nesting); {
220 subdir := h.Val()
221 switch subdir {
222 + case "verifier":
223 + if !h.NextArg() {
224 + return nil, h.ArgErr()
225 + }
226 +
227 + vType := h.Val()
228 + modID := "tls.client_auth." + vType
229 + unm, err := caddyfile.UnmarshalModule(h.Dispenser, modID)
230 + if err != nil {
231 + return nil, err
232 + }
233 +
234 + _, ok := unm.(caddytls.ClientCertificateVerifier)
235 + if !ok {
236 + return nil, h.Dispenser.Errf("module %s is not a caddytls.ClientCertificatVerifier", modID)
237 + }
238 +
239 + cp.ClientAuthentication.VerifiersRaw = append(cp.ClientAuthentication.VerifiersRaw, caddyconfig.JSONModuleObject(unm, "verifier", vType, h.warnings))
240 case "mode":
241 if !h.Args(&cp.ClientAuthentication.Mode) {
242 return nil, h.ArgErr()