我基本上了解@DeclareRoles
和@RolesAllowed
的功能,但是我不确定在哪里正确添加@DeclareRoles
。我用一个vaadin应用程序进行了测试,该应用程序在玻璃鱼4中使用了ejb会话bean和cdi。
@DeclareRoles
:显然没有任何效果。 HttpServletRequest.isUserInRole()
和SessionContext.isCallerInRole()
始终返回false。 @RolesAllowed
始终拒绝访问。@DeclareRoles
在Servlet上:@RolesAllowed
和HttpServletRequest.isUserInRole()
正常工作。 SessionContext.isCallerInRole()
总是返回false。@DeclareRoles
在会话bean上:@RolesAllowed
,HttpServletRequest.isUserInRole()
和SessionContext.isCallerInRole()
正常工作。即使在与SessionContext.isCallerInRole()
@DeclareRoles
@DeclareRoles
的正确位置在哪里?SessionContext.isCallerInRole()
或@RolesAllowed
的bean注释?