[英]Websocket authentication in Wildfly with RolesAllowed
I have a web socket defined using standard annotation like so我有一个像这样使用标准注释定义的网络套接字
@ServerEndpoint("/mySocket")
@Singleton
public class myWebsocket {
@Inject
private MyEjb myEjb;
@OnMessage
public void message(Session session, String msg) { ...
Even though my user has logged in, I get access exceptions when calling myEjb because it doesn't recognize my user.即使我的用户已登录,我在调用 myEjb 时也会遇到访问异常,因为它无法识别我的用户。 If I check the principal of my session object
如果我检查会话对象的主体
session.getUserPrincipal().getName()
the correct user is found, however, if I check the jboss SecurityContext class, I see an anonymous user找到了正确的用户,但是,如果我检查 jboss SecurityContext 类,我会看到一个匿名用户
This is a known deficiency in Java EE 7 WebSocket specification, see the following issue in their bug-tracker.这是 Java EE 7 WebSocket 规范中的一个已知缺陷,请参阅他们的错误跟踪器中的以下问题。
However, there is a workaround available, see the JBoss Security Extended project and this example .但是,有一个可用的解决方法,请参阅JBoss Security Extended项目和此示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.