We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b49779d commit 33debc8Copy full SHA for 33debc8
app.go
@@ -85,8 +85,9 @@ func main() {
85
}
86
87
server := &http.Server{
88
- Addr: ":" + port,
89
- Handler: mux,
+ Addr: ":" + port,
+ TLSConfig: &tls.Config{ClientAuth: tls.RequestClientCert},
90
+ Handler: mux,
91
92
93
if ca != "" {
@@ -230,6 +231,13 @@ func whoamiHandler(w http.ResponseWriter, r *http.Request) {
230
231
232
233
_, _ = fmt.Fprintln(w, "RemoteAddr:", r.RemoteAddr)
234
+
235
+ if r.TLS != nil {
236
+ for i, cert := range r.TLS.PeerCertificates {
237
+ fmt.Fprintf(w, "Certificate[%d] Subject: %v\n", i, cert.Subject)
238
+ }
239
240
241
if err := r.Write(w); err != nil {
242
http.Error(w, err.Error(), http.StatusInternalServerError)
243
return
0 commit comments