I have a java application running in Tomcat. I added https listener on port 8443 as described here:
https://docs.spring.io/spring-boot/docs/2.2.x/reference/pdf/spring-boot-reference.pdf (9.3.13. Enable Multiple Connectors with Tomcat)
I additionally configured the listener to challenge clients to present certificates (2-way-TLS / mutual TLS) and have a truststore with trusted entries. All of this works and I can see the whole TLS-Handshake in the logs, along with the client certificate presented.
I have a WebSocket server endpoint (@javax.websocket.server.ServerEndpoint
) which does get called when a client is connecting via "wss://....." after the secure tls tunnel is established, the @OnOpen
method is called and it has javax.websocket.Session object. So the http(s) upgrade to ws works.
My Question: After the TLS-Handshake is performed (triggered by WSS: ws over https in my case), I need to extract client certificate (X509) information (subject / issuer etc..) and have it available in the @OnOpen method. I was searching for some Interceptors or another way to access and extract certificate data and make it available after the upgrade to ws is done. Is there any way to access HttpServletRequest
from the @OnOpen
web socket handling method? Appreciate your help.