How can I programmatically enable WSS for a Tyrus WebSocket @ServerEndpoint

后端 未结 2 1109
忘了有多久
忘了有多久 2021-01-21 14:10

I have a microservice that has a REST endpoint and a WebSocket endpoint.

It Spring-wires Grizzly and Tyrus, and adds in authentication via SSO using a JAX-RS filter and

2条回答
  •  孤城傲影
    2021-01-21 14:36

    Solved using the suggestion at https://stackoverflow.com/a/27239122/17641

    listener = new NetworkListener("grizzly", "0.0.0.0", port); listener.setSecure(true); listener.setSSLEngineConfig(new SSLEngineConfigurator(getSslContextConfigurator()).setClientMode(false).setNeedClientAuth(false));

    Where getSslContextConfigurator constructs a org.glassfish.grizzly.ssl.SSLContextConfigurator with a keystore byte[] and password.

提交回复
热议问题