thesoretoothsayer
thesoretoothsayer

Reputation: 11

Spring authenticating ldap example and real ldap server

long time listener, first time caller.

I have downloaded the spring authenticating ldap example at: https://spring.io/guides/gs/authenticating-ldap/ into STS. It works fine.

However, I'd like to try and get it working with a real ldap database such as the one the kind folks at forumsys.com have made available: http://www.forumsys.com/en/tutorials/integration-how-to/ldap/online-ldap-test-server/

My current configuration for configureGlobal is:

    @Autowired
public void configureGlobal(AuthenticationManagerBuilder authBuilder) throws Exception {

    authBuilder
        .ldapAuthentication()
        .userSearchFilter("(uid={0},dc=example,dc=com)")
        .userSearchBase("")
        .contextSource()
            .url("ldap://ldap.forumsys.com:389/dc=example,dc=com")
       .managerDn("cn=read-only-admin,dc=example,dc=com") 
            .managerPassword("password");

}

This returns a bad credentials error when I try to login with "tesla/password" or "einstein/password". Would anyone be able to advise what setup in configureGlobal would result in a valid login?

Thanks, Sore

Upvotes: 0

Views: 1170

Answers (1)

thesoretoothsayer
thesoretoothsayer

Reputation: 11

This seems to work:

authBuilder
            .ldapAuthentication()
            .userSearchFilter("(uid={0})")
            .userSearchBase("")
            .contextSource()
                .url("ldap://ldap.forumsys.com:389/dc=example,dc=com")
           .managerDn("cn=read-only-admin,dc=example,dc=com") 
                .managerPassword("password");

Upvotes: 1

Related Questions