Hum*_*ity 9 grails spring-security websocket atmosphere
我正在努力将WebSockets功能引入我的Grails应用程序.为此,我使用Atmosphere Meteor插件0.7.1.工作流程很简单:
我想知道哪个用户连接了我的webSocket.
通常,通过springSecurityService.getPrincipal()在任何控制器中调用来检测当前用户非常容易.我设法向springSecurityService我的MeteorHandler 注入,但是它表示校长是null.这对我来说很奇怪,因为处理程序可以访问JSESSIONIDcookie,所以我希望它能够检索正确的会话数据.
此外,request.session与在常规控制器操作中执行的相同命令相比,命令返回不同的HttpSession对象.
那么有没有办法在webSockets连接上检索当前登录的用户?
提前致谢.
可以轻松地从以下位置检索主体对象request.userPrincipal.principal
它与中的对象完全相同springSecurityService.getPrincipal()
在这里找到更多:https://github.com/kensiprell/grails-atmosphere-meteor/issues/28#issuecomment-34629462
| 归档时间: |
|
| 查看次数: |
1172 次 |
| 最近记录: |