0

I have a Java WebSocket server running on GlassFish, and users are to connect using client TLS certificates that we give them. The distinguished name from the certificate is what we used to identify the user. Once a connection has been made to a ServerEndpoint, my @OnOpen method is called and given a Session object.

I can tell if session.isSecure(), but nothing more than that. The Session object gives me no visibility into the properties of the TLS connection. How do I fetch the distinguished name of a client when they're connected via WebSocket?

directedition
  • 11,145
  • 18
  • 58
  • 79

1 Answers1

0

I believe you can only do that in the websocket handshake (see here for an idea).

Websocket are "upgraded" from a HTTP request and the details of the request are available only during that upgrade request. You could try to extract the user principal from the HandshakeRequest, which normally should get you a X500Principal.

Community
  • 1
  • 1
Bogdan
  • 23,890
  • 3
  • 69
  • 61