我一直在这里以下WebSocket的教程和一切都很顺利:http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/HomeWebsocket/WebsocketHome.htmlWSS失败Wildfly 9 openshift
而我部署该应用程序使用openshift Wildfly,一切都很好。 ws正在端口8000上工作。
现在我试图使用wss来保护websocket。下面是我做的:
在web.xml中,我说:
<security-constraint>
<display-name>Secure WebSocket Endpoint</display-name>
<web-resource-collection>
<web-resource-name>Secure WebSocket Endpoint</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
然后在我的客户,我取代“WS”与“WSS”,并更改了端口从8000到8443所以它看起来像:
wss://fakeappname.rhcloud.com:8443/actions
部署更新的应用OpenShift后,我发现网页被重定向到https,这是很好的。但是wss根本不起作用,没有错误消息。
我在互联网上搜索了2天,并尝试了很多不同的方法,但都没有工作。
我也试图在.openshift/config/standalone.xml
添加https-listener
:
<https-listener name="default-https" socket-binding="https" security-realm="ApplicationRealm"/>
其中 “ApplicationRealm” 被定义为:
<security-realm name="ApplicationRealm">
<authentication>
<local default-user="$local" allowed-users="*" skip-group-loading="true"/>
<properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization>
<properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
但它也不能工作。我不知道为什么它在http中起作用,但是在安全性被强制执行时它没有。
请帮忙!任何提示将不胜感激!
我在Openshift上遇到了同样的问题,我创建了jdbc security-realm,更改为'/ jsf-pages/*',但是我的websocket没有“授权”头部工作... REST服务完美运行。你换了别的东西吗? – PatrykG