【问题标题】:Is There A Generic Way To Search For LDAP Groups With Shiro?是否有使用 Shiro 搜索 LDAP 组的通用方法?
【发布时间】:2017-02-02 09:58:11
【问题描述】:

我使用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 依赖项中?

【问题讨论】:

    标签: ldap shiro


    【解决方案1】:

    我认为最大的问题是在 LDAP 中存储东西的方式有很多种,不过有很多常用技术。

    op 将此移至邮件列表线程:http://shiro-user.582556.n2.nabble.com/New-LDAP-Realm-Proposal-tp7581200p7581291.html

    【讨论】:

      猜你喜欢
      • 2016-12-30
      • 2014-06-25
      • 2014-07-25
      • 1970-01-01
      • 2010-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多