I have Spring Boot REST controller that uses mutual HTTPS authentication with keystores on both server and client side. The server side has the controller class with @RequestMapping. HTTPS between server and client seems otherwise working fine.
There are multiple clients that have different they matching entries configured on the server trust store. When inside the controller body, I need to know which trust store entry has been used to authenticate the current client.
I have attempted the answer for this question using the injected HttpServetRequest (method parameter), but there is nothing on the request parameters. Unfortunately, seems that request.getAttribute("javax.servlet.request.X509Certificate")
just returns null, even if I am sure the interaction was via HTTPS. request.getAttribute("javax.servlet.request.cipher_suite")
returns TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256.
How to get from withing the Spring Rest Controller method any information about which certificate is being used?
Spring framework 4.3.11.RELEASE, embedded Tomcat 8.0.23, Spring Boot 1.5.1.RELEASE.