Win a copy of Kotlin Cookbook this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

Spring security with LDAP Authentication

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to make ldap connection with spring security. This is connecting with normal JNDI but not with spring security. My LDAP server is on windows with NTLM authentication. I even disabled NTLM authentication but this is not working. Please help with this at the earliest



@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {

                 auth
.ldapAuthentication()
.contextSource()
.url("ldap://ipaddress:389/DC=LDAPTest,DC=com")
.managerDn("administrator@ldaptest.com")
.managerPassword("mypassword")
.and()
.userSearchBase("OU=CRYSTAL,DC=LDAPTest,DC=com");
// .userDnPatterns("cn={0}");
}
 
Saloon Keeper
Posts: 21478
144
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Saritha!

If you're looking for a cookbook answer, we're not the place to look. And since we're not paid to do this, "urgent" isn't something you should expect here either. Our primary purpose is to help people learn in an environment where they can feel comfortable and not get flamed or called stupid.

When using Active Directory for authentication the main thing to keep in mind is that unlike other LDAP servers, Active Directory has special entries that describe Windows-specific user properties and so the LDAP search rules have to be set up to use those properties instead of the more general ones you may see in non-AD LDAP examples. Do an Internet search for "Windows Active Directory LDAP authentication" and you should find some specifics.

One thing to note, though. If all application users are going to be local Windows users operating under their own identifies, you can bypass the whole LDAP thing and use basic NTLM single-signon authentication so that a user never actually has to login to the app itself, since they logged into Windows already. In the case of the Tomcat webapp server, for example, there's a custom security Realm module you can use. Actually more than one, I think. The original one was called CAS.
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!