根据软件许可证标志更改 JAAS 角色
我有一个在 JBOSS 上运行的非常普通的 Java EE 应用程序。 它使用 JBoss DatabaseLoginModule JAAS 身份验证。 它在 Hibernate 中也有完全相同的应用层用户/角色。
我有一个想法(无论如何,我认为这对我来说非常有用),我可以在软件许可证对象(不使用休眠)中设置一个功能位,使所有用户成为只读用户。 这让我可以通过重新许可来制作该产品的只读版本。
我想做的是根据程序内部可访问的布尔标志重新映射用户关联。
所以通常我们得到(多对多连接)
User -*UserRole*-Role -*RoleActions
where
user.roleid =>role.id
当布尔值被设置时(软件许可证中设置的功能位)
我想要 JAAS当许可证如此规定时,就像所有用户都是 roleid =1 一样。
有任何想法吗 ?
I've got a pretty ordinary Java EE application running on JBOSS.
It uses the JBoss DatabaseLoginModule JAAS authentication.
It also has application layer users/roles in Hibernate that are exactly the same.
I've got an idea ( which I think is pretty useful for me, anyway) to have a capability bit I can set in the software license object (not using hibernate) that makes all users the read-only user. This lets me make a read only version of the product by relicensing it.
What I'd like to do is remap the user associations based on a boolean flag accessible inside the program.
So normally we get ( many-many join)
User -*UserRole*-Role -*RoleActions
where
user.roleid =>role.id
When the boolean is set ( a capability bit set in the software license )
I'd like JAAS to act like all users were roleid =1 when the license says so.
Any ideas ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过子类化 DatabaseServerLoginModule 我可以执行额外的检查。 (在软件许可证上)
简单地说,我可以
如果许可证已过期,请提供只读用户(凭据已修复)
由于登录已被拦截,Hibernate 用户查找将针对正确的用户。
By subclassing DatabaseServerLoginModule I can perform extra checks. ( on the software licence)
Trivially I can then
If the licence is expired, give A Readonly user ( the credentials are fixed)
If the license has the read-only capability bit set, give the Read-only user ( the credentials are fixed)
Since the login has been intercepted, the Hibernate User lookup will be for the right user.
也许我在这里错过了机会,但为什么不以编程方式做到这一点呢?
在
User
对象中,提供一个类似于getAuthenticatedRoles()
的瞬态 getter,它会另外过滤Hibernate
加载的内容。 此外,使原始映射集合 getterprotected
,并仅使用其他 Java 代码中的getAuthenticatedRoles()
。Maybe I'm missing the boat here, but why not do that programatically?
In
User
object, provide a transient getter likegetAuthenticatedRoles()
that would additionally filter whatHibernate
loaded. Additonally, make the original mapped collection getterprotected
, and use onlygetAuthenticatedRoles()
from other Java code.