Hi,
I am writing a module for Caddy2. I need to require a client SSL certificate and to access it in my plugin code.
In Caddy1 I used the tls settings in the Caddyfile
tls cert key {
clients require
}
Which later made it possible for me to access it in my code:
func getClientCertificate(req *http.Request) *x509.Certificate {
if (len(req.TLS.PeerCertificates) > 0) {
cert := req.TLS.PeerCertificates[0]
return cert
}
return nil
}
How can I do the same in Caddy2? How to setup the Caddyfile (for version2) in order to require a Client SSL certificate be present?