websocket icon indicating copy to clipboard operation
websocket copied to clipboard

Method to access SSL certificates at handshake

Open glassfishrobot opened this issue 9 years ago • 4 comments

When a WS connection is established through a secure TLS connection, it would be useful to get info about the certificates used. In a JAX-RS ContainerRequestFilter I'm used to get this information using:

@Priority(Priorities.AUTHENTICATION)
public class AuthenticationFilter implements ContainerRequestFilter {
    @Override
    public void filter(ContainerRequestContext containerRequestContext) throws IOException {
        X509Certificate[] certificates = (X509Certificate[]) containerRequestContext.getProperty("javax.servlet.request.X509Certificate");
        // process authentication based on certificates
    }
}

I tried to use a similar approach in a custom ServerEndpointConfig.Configurator, looking for the same information in the HandshakeRequest, but I couldn't find a way to get it.

glassfishrobot avatar Mar 24 '16 14:03 glassfishrobot

  • Issue Imported From: https://github.com/javaee/websocket-spec/issues/242
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: @pavelbucek

glassfishrobot avatar Feb 12 '18 08:02 glassfishrobot

@glassfishrobot Commented Reported by heruan

glassfishrobot avatar Mar 24 '16 14:03 glassfishrobot

@glassfishrobot Commented This issue was imported from java.net JIRA WEBSOCKET_SPEC-242

glassfishrobot avatar Apr 24 '17 11:04 glassfishrobot

See also #255 and #218

markt-asf avatar Apr 16 '20 16:04 markt-asf