首页 文章

Grails,Spring Security LDAP插件

提问于
浏览
2

我正在尝试使用LDAP插件 . 我只想对Active Directory进行LDAP身份验证,但似乎我遗漏了一些东西 .

配置

grails {
    plugins {
        springsecurity {


            userLookup.userDomainClassName = 'de.ac.dmf.security.User'
            userLookup.authorityJoinClassName = 'de.ac.dmf.security.UserRole'
            authority.className = 'de.ac.dmf.security.Role'

            ldap {
                context.managerDn = 'CN=dmf Systemuser,CN=Users,DC=dmf,DC=local'
                context.managerPassword = 'Password1'
                context.server = 'ldap://192.168.100.133:389/'
                authorities{
                    groupSearchBase ='OU=Groups'
                    groupSearchFilter = '(member={0})'
                    retrieveGroupRoles = false
                    retrieveDatabaseRoles = false
                    defaultRole = 'USER'
                    ignorePartialResultException = true
                }
                search{
                    base = 'CN=Users,DC=dmf,DC=local'
                    filter = '(sAMAccountName={0})'
                    searchSubtree = true

                }
                // mapper.userDetailsClass = 'user'
                // auth.hideUserNotFoundExceptions = false
                useRememberMe = false
            }
        }
    }
}

每次登录时我都会遇到此异常

2011-04-29 08:49:09,129 [http-8080-1] DEBUG springsecurity.RequestHolderAuthenticationFilter  - Authentication request failed: org.springframework.security.authentication.AuthenticationServiceException: [LDAP: error code 32 - 0000208D: NameErr: DSID-031001E4, problem 2001 (NO_OBJECT), data 0, best match of:
    'CN=Users,DC=dmf,DC=local'; remaining name 'CN=Users,DC=dmf,DC=local'

我尝试验证的AD中的哪个用户无关紧要 . 我的配置错了吗?

我正在使用

  • Grails 1.3.7

  • spring-security-core 1.1.2

  • spring-security-ldap 1.04

3 回答

  • 0

    你确定你的基本配置?看起来像 OU=Users 可以工作而不是 CN=Users . 解决这个问题的最简单方法是使用广告资源管理器(http://technet.microsoft.com/de-de/sysinternals/bb963907)等工具,连接到您的AD,浏览用户并查看路径给用户......

  • 0

    尝试使用:

    filter = '(&(sAMAccountName={0})(objectclass=user))'
    

    这适用于我们的AD .

  • 0

    您缺少提供者名称列表 .

    grails.plugins.springsecurity.providerNames = ['ldapAuthProvider',
        'anonymousAuthenticationProvider',
        'rememberMeAuthenticationProvider']
    

相关问题