wood burning stoves 2.0*
The moose likes Spring and the fly likes Spring LDAP/Active Directory Security: Authenticate User w/out Using an Admin/Mgr Account Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring LDAP/Active Directory Security: Authenticate User w/out Using an Admin/Mgr Account" Watch "Spring LDAP/Active Directory Security: Authenticate User w/out Using an Admin/Mgr Account" New topic
Author

Spring LDAP/Active Directory Security: Authenticate User w/out Using an Admin/Mgr Account

Gregg Leichtman
Greenhorn

Joined: Jan 26, 2011
Posts: 2
I am using Spring Security 3.1.0M2 and LDAP 1.3.1, the most current as of this date, to authenticate users via a login form. I am trying to determine if it is possible to eliminate the need for an admin/mgr account, as declared below in the DefaultSpringSecurityContextSource. On our LDAP server, all users are able to connect to and query the server, so there is no need for an admin account to do this and this is actually undesirable for our company needs. Can anyone state that this is definitely not possible with Spring Security, or if it is possible point me to either configuration or code to accomplish this?

I am successfully authenticating users with the following Spring configuration:
-=> Gregg <=-
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

It might be possible with Spring's Expression Language. Spring Security supports the expression language.

Or you can always customize Spring Security to do this. In this case, those Spring LDAP classes can be extended or I am sure there is an interface that you can implement and then you write custom code in the setUserDn or setPassword methods, but it might also entail overriding methods in the other LDAP classes that reference the "ldapServer" bean and then take the data coming in through the Http request from the login form.

Or, doing a Google search or two I found this
http://www.jarvana.com/jarvana/view/org/springframework/ldap/spring-ldap/1.2/spring-ldap-1.2-javadoc.jar!/org/springframework/ldap/core/AuthenticationSource.html

You might just implement this method and that would be the only custom class you need to deal with in Java, then add it to the config and use your custom one.

Mark




Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ramana Chilakalapudi
Greenhorn

Joined: Feb 15, 2012
Posts: 1
Hi Gregg,

I am new to Spring Security and your post looks quite useful. I have a similar requirement of integrating with Active Directory.

In your security application context can you please throw some light on the functionality of the class "com.myCompany.myWebappContext.server.security.RoleGrantingLdapAuthoritiesPopulator".

Also if you can put some light on your web layer, i mean your web.xml and any jsp's for controlling the authorization it would be very helpful.

Thanks,
Ramana
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Spring LDAP/Active Directory Security: Authenticate User w/out Using an Admin/Mgr Account