玻璃鱼 3.1 + Kerberos +来自数据库的角色 (JDBC)
我无法找到如何从数据库(JDBC)获取使用 Kerberos 授权的用户的角色。 Kerberos 登录工作正常,但用户没有任何角色。 我使用 spnego-r7 来运行 Kerberos - http://spnego.sourceforge.net/index.html 我找不到任何教程或建议如何做到这一点。 你有什么想法或例子吗?
I can't find out how to get roles from database (JDBC) for user authorised with Kerberos. Kerberos login works ok but user doesn't have any roles.
I used spnego-r7 to run Kerberos - http://spnego.sourceforge.net/index.html
I can't find any tutorial or advices how to do it.
Do you have any idea or example?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是您的任务,而不是 Kerberos 的任务。 Kerberos 只是身份验证。当 userprincipal 从响应中传递时,在您的 JDBC 领域中查找并检索您的角色。这意味着这是一个两步过程。
This is your task, not Kerberos'. Kerberos is solely authentication. When the userprincipal is passed from the response look that up in your JDBC realm and retrieve your roles. This means that it is a two step process.
您可以 (1) 以非容器管理的方式(即在您的应用程序中)处理用户组,或 (2) 尝试绑定到容器特定的安全机制。我还没有成功利用 Glassfish 安全性来分配组,但看来您必须创建至少两个类:一个扩展 com.sun.appserv.security.AppservRealm,另一个扩展 com.sun.appserv.security.AppservPasswordLoginModule 。前者有一个名为 getGroupNames 的方法,该方法接受用户名作为参数,后者有一个名为 commitUserAuthentication 的方法,该方法接受一组组名称。不幸的是,目前尚不清楚它应该如何工作,并且似乎没有很好的记录。更多信息请参见:http://docs.oracle.com /cd/E19226-01/820-7695/beabs/index.html 和此处:https://blogs.oracle.com/nithya/entry/groups_in_custom_realms
You can (1) handle user groups in a non-container managed way (i.e. in your application) or (2) try to tie into the container specific security mechanism. I haven't successfully tapped into Glassfish security for assigning groups, but it appears you must create at least two classes: one that extends com.sun.appserv.security.AppservRealm, and one that extends com.sun.appserv.security.AppservPasswordLoginModule. The former has a method named getGroupNames which takes a username as a parameter and the later has a method named commitUserAuthentication which takes an array of group names. Unfortunately it isn't clear how it is supposed to work and seems poorly documented. More information here: http://docs.oracle.com/cd/E19226-01/820-7695/beabs/index.html and here: https://blogs.oracle.com/nithya/entry/groups_in_custom_realms