Tomcat服务器访问限制导致Websocket不';t连接

Tomcat服务器访问限制导致Websocket不';t连接,tomcat,websocket,Tomcat,Websocket,当我将tomcat服务器配置为具有用户控制访问权限时,基于Websocket的聊天客户端无法连接到服务器,但页面的其余组件运行正常。您知道如何使用此配置使websocket工作吗? 我已经配置了控制访问权限,更改了tomcat-users.xml文件(添加到“tomcat users”用户名、密码和rol)并更改了web.xml文件,添加: <security-constraint> <web-resource-collection> <url-patte

当我将tomcat服务器配置为具有用户控制访问权限时,基于Websocket的聊天客户端无法连接到服务器,但页面的其余组件运行正常。您知道如何使用此配置使websocket工作吗? 我已经配置了控制访问权限,更改了tomcat-users.xml文件(添加到“tomcat users”用户名、密码和rol)并更改了web.xml文件,添加:

 <security-constraint>
 <web-resource-collection>
   <url-pattern>/*</url-pattern>
 </web-resource-collection>
 <auth-constraint>
   <role-name>user</role-name>
 </auth-constraint>
 </security-constraint>

/*
用户


基本的
访问控制

包含聊天websocket的页面在没有控制访问的情况下运行良好,但此时我需要在服务器上实现此限制。

在internet上寻找答案很长时间后,我发现许多评论表明HTTP身份验证方法的实现与websocket不兼容。必须使用其他方法进行身份验证


什么版本的tomcat?
 <login-config>
 <auth-method>BASIC</auth-method>
 <realm-name> Access Control </realm-name>
 </login-config>