java - EJB3 @RunAs 注释和安全性

标签 java security servlets ejb

@RunAs 注释允许仅通过指定角色名称来访问 bean。这意味着任何外部客户端只需指向角色名称就可以轻松访问我的 bean,不是吗?

我认为调用者和bean位于不同的服务器上。

如果伪造客户端这么容易,那么 @RunAs 还需要什么呢? 或者如果我错了,如何正确使用它?

最佳答案

有点不同。请参阅 WebSphere Application Server V7.0 Security Guide 中的第 9.6 章了解更多详细信息和示例。

When a bean calls a method in another bean, the identity of the caller is, by default, propagated to the next. In this way, all EJB methods in the calling chain see the same principal if they were to call the getCallerPrincipal() method.

Occasionally, however, it is desirable for one EJB to call another EJB with a previously defined identity, for instance, one that is a member of a specific role.

@RunAs 注释定义将用于委派的角色。您仍然可以使用 @RolesAllowed

保护第一个 bean

runAsRole 必须在应用程序部署期间从用户注册表映射到实际用户。

关于java - EJB3 @RunAs 注释和安全性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26773709/

相关文章:

ios - SecRandomCopyBytes 有多好?

php - Mysql加密/存储敏感数据,

security - 限制一个 Elastic Beanstalk 应用程序对另一个应用程序的访问

java - 如何在 servlet 线程中获取新的有状态 session bean?

java - CQRS 如何避免命令和事件之间的重复字段?

java - 尝试使用 "Permissions Dispatcher"添加棉花糖权限

java - 从 int 值获取月份

Java评分方法

javascript - 从 Servlet 向 JSP 发送响应

java - JAX-RS 与 CXF 不使用 Spring