Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Alexandre Thenorio
    @eddumelendez Interesting you shared that. I found out your project like 2 days ago
    And it is awesome
    However I am having some small issues as I am uncertain about what exactly it does and does not
    Chandan Kumar
    Hi guys I am new to SpringLdap
    can anyone explain me how to configure ldap context in java layer
    without xml
    Mauricio Aiello

    I 'll try to be simple with code. Here is my code that's work for me...

    // Make a class extends WebSecurityConfigurerAdapter
    @PropertySources({ @PropertySource("classpath:ldap.properties") })
    public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
      private Environment env;
      private AppLdapUserDetailsContextMapper appLdapUserDetailsContextMapper;
      protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        // Authentication Provider Order
        // 1. LDAP provider
      private void ldapProvider(AuthenticationManagerBuilder auth) throws Exception {
        try {
          // @formatter:off
          // @formatter:on
        } catch (IllegalStateException e) {
          LOGGER.warn("Some of the required LDAP attributes could not be readed from properties", e);
      public DefaultSpringSecurityContextSource contextSource() {
        DefaultSpringSecurityContextSource contextSource = new DefaultSpringSecurityContextSource(env
        Map<String, Object> baseEnvironmentProperties = new HashMap<>();
        baseEnvironmentProperties.put("com.sun.jndi.ldap.connect.timeout", "5000");
        return contextSource;
    public class AppLdapUserDetailsContextMapper extends InetOrgPersonContextMapper {
      public UserDetails mapUserFromContext(DirContextOperations ctx, String username,
          Collection<? extends GrantedAuthority> authorities) {
        // must be implemented for your own business
    properties file:
    ## zflexldap
    ## Search

    I think this is all.

    Hi there, I had a question on licensing. spring-ldap is using unboundid yet it is under apache 2.0. Isn't apache 2.0 incompatible with gpl, lgpl and unboundid free license? Can I use unboundid inside an apache 2.0 project?
    Rohit Nayak
    Are there exporttocsv libaries under spring-ldap? all i see is ldifexport
    Peter Reid

    Hello, has anyone ever encountered this error

    could not get unknown property 'SAMPLE_WAR_GRADLE' for root project 'user-admin' of type org.gradle.api.Project.

    when invoking gradle tasks for the 'user-admin' sample project?

    Hello, may I ask how do you import the spring ldap to a grails 3 application? I cannot seem to reference it in my application. I'm using LdapContextSource and LdapTemplate on Grails 3.3.0. Thanks.
    @ReidWeb did you every resolve the unknown property 'SAMPLE_WAR_GRADLE' error when invoking the gradle tasks for the 'user-admin' sample project?
    FYI. Resolved the SAMPLE_WAR_GRADLE error. Had to modify build.gradle with apply from: 'sample-war.gradle' instead of apply from: SAMPLE_WAR_GRADLE. Additional modifications to build.gradle are as follows: https://pastebin.com/69W0ziu6
    Matteo Gianello
    I see that this channel is not so active but i try
    I have a spring mvc application in witch i integrate spring security, in particular now i need to implement the ldap authentication but the problem is that in my basic authentication i have a CustomUserDetails and a CustomUserDetailsService now i want to manage this custom userDetails with spring ldap i try to extends LdapAuthorization provider without success someone have any idea?
    Is there any reason the SimpleLdap classes would stop being able to authenticate with an LDAP server after updating from 1.3.1 to 2.3.2? I know it has become deprecated but I do not see anything that leads me to feel like it should give me an error of: "AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1]". Moving to use the LdapTemplate and LdapOperations is a bit much for me to do at the moment and I was curious if anyone else has had the same issue. I have already researched the error and it claims to be a bad authentication issue however I have doubled checked the credentials are right along with ensuring the LDAP user is not locked.
    Marino Borra
    Hi to all, I have a question on AD & LDAP & Tomcat, I can to use an AD user (that is the same used to autenticate the Tomcat) to authenticate to the AD\LDAP server as a manager? How I can to configure Spring Security LDAP?
    Hello, what is the way to configure a timeout for queries ?
    Marcel Overdijk
    @nadavg54 I'm facing something similar
    Spring's LdapTemplate has a setDefaultTimeLimit which "Set the default time limit be used in searches if not explicitly specified."
    We tried to set it but it does not seem to work.
    We even set this value to 1ms but we are not getting the expected TimeLimitExceededException...
    We tried to debug to get more insights and we see Spring is propagating this default time limit to the default javax.naming.directory.SearchControlsbut it seems not to work
    Marcel Overdijk
    Note we are also using the Pool2 pooling support so I wonder if these are maybe not compatible?
    I also found this old post from 2013: http://forum.spring.io/forum/spring-projects/data/ldap/48303-maximum-search-completion-time-limit-using-settimelimit where somebody was facing the same problem.
    Marcel Overdijk
    Anyone seeing similar behaviour?
    Marcel Overdijk
    Note I also tried without a PooledContextSource and default time limit 1 ms and I don't get the TimeLimitExceededException. It simply seems not to work.
    Marcel Overdijk

    This seems to work:

    final Map<String, Object> baseEnv = new Hashtable<>();
    baseEnv.put("com.sun.jndi.ldap.connect.timeout", "5000");
    baseEnv.put("com.sun.jndi.ldap.read.timeout", "5000");
    final LdapContextSource ldapContextSource = new LdapContextSource();

    if I pass this to the LdapTemplate I get connect/read timeouts eventually. LdapTemplate#setDefaultTimeLimitdoes not seem to do anything.

    Hope this might be useful for other users.
    Hi @all
    I'm getting high numConnectionsClosedDefunct in my ldap logs, any thoughts?
    hi can some one help me
    LDAP: error code 53 - 0000052D: SvcErr: DSID-031A120C, problem 5003 (WILL_NOT_PERFORM), data 0
    Josh Cummings
    @codertiu Can you provide a bit more information?
    Hello everyone. I am new here. I want to ask about spring-ldap client load balancing features.
    Is there such features? I really like spring-ldap and spring-data-ldap integrations and don't want to switch to unboundid sdk for client side load balancing.
    LDAP: error code 49 - Unable to bind as user 'uid=admin,ou=people,dc=spring,dc=org' because the provided password was incorrect
    Hi @all Knowing an attribute of entry, and knowing ou, how to use ldaptemplate to deduce dn?
    i don't understand your question @Matthew-Han
    For example , The attribute of an entry is '003001' , Let's assume that the Attr is deId , and this entry's DN is "deId=003001,deId=003,ou=department", I just know deId is '003001' and 'ou=department' , how to use ldaptemplate to deduce dn? I can't find a method in ldaptemplate.
    @sadoudiallo_gitlab 003001 is the next level of 003
    A DN is an absolute path and ascends the tree from left to right. I think you can build the DN if you know the other attributes. look at LdapBuilder.newInstance. maybe it can help you.
    @sadoudiallo_gitlab Thank you for your answer.
    Edward J Beckett
    Does anyone know how to implement an interceptor for the ldapTemplate similar to webServiceTemplate interceptor?
    Hello. I'm using an LdapRpository<com.company.User>. I'd like my user to have a Set<GrantedAuthority>. How can I (a) get ldapGroups and (b) turn map them into GrantedAuthorities for the User class? Any hints appreciated.
    Josh Cummings
    @Holothuroid I believe what you are looking for is LdapAuthoritiesPopulator. There is a default implementation called DefaultLdapAuthoritiesPopulator that you might find of interest. Or you might simply create you own, like LdapRepositoryLdapAuthoritiesPopulator.
    Isaac Figueroa
    Anyone know how to do an attribute scoped query using spring ldap?
    @jzheaux Thanks. That worked.