2
votes

I'm trying to get the LDAP plugin work. I only want a LDAP authentication against an Active Directory but it seems that I'm missing something.

Config

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
            }
        }
    }
}

On every login I just get this exception

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'

It doesn't matter which user from my AD I'm trying to authenticate. Is my configuration wrong?

I'm using

  • Grails 1.3.7
  • spring-security-core 1.1.2
  • spring-security-ldap 1.04
3
My problem was a second LDAP template which was initialized. After removing this my login problem was solved.onigunn

3 Answers

0
votes

are you sure about your base configuration? Looks like OU=Users could work instead of CN=Users. Easiest way to figure this out is to use a tool like ad explorer (http://technet.microsoft.com/de-de/sysinternals/bb963907), connect to your AD, browse to a user and take a look at the path to the user...

0
votes

Try using:

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

That works on our AD.

0
votes

You are missing the provider name list.

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