是否有一种通用的方式来搜索Shiro的LDAP组?

时间:2016-09-24 18:04:19

标签: ldap shiro

我使用org.apache.shiro.realm.ldap.DefaultLdapRealm对LDAP进行身份验证(以ldap://ldap.forumsys.com:389/dc=example,dc=com为例)。

但是,当我尝试检查角色时,它总是失败。事实证明,DefaultLdapRealm在搜索组时返回null。

/**
 * Method that should be implemented by subclasses to build an
 * {@link AuthorizationInfo} object by querying the LDAP context for the
 * specified principal.</p>
 *
 * @param principals          the principals of the Subject whose AuthenticationInfo should be queried from the LDAP server.
 * @param ldapContextFactory factory used to retrieve LDAP connections.
 * @return an {@link AuthorizationInfo} instance containing information retrieved from the LDAP server.
 * @throws NamingException if any LDAP errors occur during the search.
 */
protected AuthorizationInfo queryForAuthorizationInfo(PrincipalCollection principals,
                                                      LdapContextFactory ldapContextFactory) throws NamingException {
    return null;
}

similar question from 2012,但它看起来像是ActiveDirectoryRealm代码的副本。

每个人是否希望在使用Shiro的群组中使用LDAP时是否必须编写自定义域?

DefaultLdapRealm无法获取为组配置搜索过滤器的属性,但不需要额外的代码(例如userDNTemplate用于登录)?

这样的领域是否已存在于maven依赖中?

1 个答案:

答案 0 :(得分:0)

我认为最大的问题是有很多不同的方法可以在LDAP中存储东西,但是有很多常用的技术。

将其移至邮件列表主题:http://shiro-user.582556.n2.nabble.com/New-LDAP-Realm-Proposal-tp7581200p7581291.html

相关问题