与 JAAS 兼容的用户/组实现
我计划创建一个 Java EE 应用程序,其中显然会有用户、组和权限。 由于此应用程序是全新的,因此我将使用 Java EE 6 和 EJB 安全性注释:@RolesAllowed
,@DeclareRoles
,...
在这种情况下,我正在寻找一种方法来简单地实现用户/组/角色管理。 那么,是否有任何库可以插入我的网络应用程序,允许我创建用户、组并为他们分配角色?或者我必须自己完成所有这些工作吗?
编辑 根据我的发现,这可以使用 JDBC 领域来实现。更具体地说,以 Flexible JDBC Realm 为例,我所要做的就是声明用户/组在我的应用程序中,然后将它们绑定到该领域。我说得对吗?
I plan to create a Java EE application in which, obviously, there will be users, groups and rights.
As this application is all new, I'll use Java EE 6 and EJB security annotations : @RolesAllowed
, @DeclareRoles
, ...
In this context, I'm looking for a way to implement simply the users/groups/roles management.
So, is there any lib I could plug in my webapp that would allow me to create users, groups and assign them roles ? Or will i have to do all that job by myself ?
EDIT From what I've discovered, this can be achieved using a JDBC Realm. More specifically, using as an example Flexible JDBC Realm, all I have to do is to declare Users/Groups in my application, then bind them to that realm. Am I right ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您可以尝试 LDAP 目录(例如 OpenDS)。在 Glassfish 上设置 LDAP JAAS 领域非常容易,然后您可以在外部管理组和用户。
如果您不想在数据库中实现它,您可以使用 JDBC 领域并将它们配置为在您的应用程序架构上工作。您必须自己管理用户和组,但可以配置提供的 JAAS 模块,并且通常不必编写自己的模块。
Maybe you can try LDAP directory (e.g. OpenDS). It's quite easy to setup LDAP JAAS realm on Glassfish and you can manage groups and users externally then.
If you wan't to implement it in database you can use JDBC realms and configure them to work on your application's schema. You will have to manage users and groups on your own but it's possible to configure provided JAAS modules and you usually don't have to write your own.
事实证明,并没有真正的 JavaEE 规范:如果 JavaEE 规范涵盖了领域定义,则大多数领域代码都特定于应用程序服务器和底层存储系统。
Turned out there is no real JavaEE spec for that : if the realm definition is covered by JavaEE spec, most of the realm code is specific to both application server and underlying storage system.