Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
7e57190724 |
8
app.go
8
app.go
@ -86,6 +86,7 @@ func main() {
|
||||
|
||||
server := &http.Server{
|
||||
Addr: ":" + port,
|
||||
TLSConfig: &tls.Config{ClientAuth: tls.RequestClientCert},
|
||||
Handler: mux,
|
||||
}
|
||||
|
||||
@ -230,6 +231,13 @@ func whoamiHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
_, _ = fmt.Fprintln(w, "RemoteAddr:", r.RemoteAddr)
|
||||
|
||||
if r.TLS != nil {
|
||||
for i, cert := range r.TLS.PeerCertificates {
|
||||
_, _ = fmt.Fprintf(w, "Certificate[%d] Subject: %v\n", i, cert.Subject)
|
||||
}
|
||||
}
|
||||
|
||||
if err := r.Write(w); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
Reference in New Issue
Block a user