Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65540

UsernameNotFoundException in LDAP Plugin with multiple AD Server

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • ldap-plugin
    • Jenkins (container) 2.281
      LDAP Plugin 2.6

      I use LDAP plugin to authentication, and there are two target AD Server.
      Everything works fine, but recently I started seeing the logs section full of this error:

      Failed communication with ldap server 6cOWbB57Lhug+DHcZ2de3w== (<<DNS name of the first server>>)
      org.springframework.security.core.userdetails.UsernameNotFoundException: User <<myuser>> not found in directory.

      To give full context : <<myuser>> is present in second AD server and not in the first one, but there are other user in same condition for which this error doesn't happen. I also noticed that this logs is generated even when I'm not logged in with <<myuser>> (but it always refers <<myuser>>). I can provide the full stack trace if necessary.

          [JENKINS-65540] UsernameNotFoundException in LDAP Plugin with multiple AD Server

          Same here. Every minute an exception with stacktrace is thrown. This spams our log! Is there any workaround? Thanks!

          This is the (shortened!) log entry:

          2025-01-03 12:05:16.552+0000 [id=12915] WARNING h.s.LDAPSecurityRealm$DelegateLDAPUserDetailsService#loadUserByUsername: Failed communication with ldap server 1oytZZjBC63KKB7eWOTDjQ== (10.1.10.251)
          org.springframework.security.core.userdetails.UsernameNotFoundException: User monitor not found in directory.
                  at PluginClassLoader for ldap//org.springframework.security.ldap.search.FilterBasedLdapUserSearch.searchForUser(FilterBasedLdapUserSearch.java:107)
                  at PluginClassLoader for ldap//hudson.security.LDAPSecurityRealm$LDAPUserDetailsService.loadUserByUsername(LDAPSecurityRealm.java:1298)
                  at PluginClassLoader for ldap//hudson.security.LDAPSecurityRealm$DelegateLDAPUserDetailsService.loadUserByUsername(LDAPSecurityRealm.java:1220)
                  at PluginClassLoader for ldap//hudson.security.LDAPSecurityRealm$LDAPAuthenticationManager.authenticate(LDAPSecurityRealm.java:1009)
          
          ... + 56 more lines

          Dominik Vorreiter added a comment - Same here. Every minute an exception with stacktrace is thrown. This spams our log! Is there any workaround? Thanks! This is the (shortened!) log entry: 2025-01-03 12:05:16.552+0000 [id=12915] WARNING h.s.LDAPSecurityRealm$DelegateLDAPUserDetailsService#loadUserByUsername: Failed communication with ldap server 1oytZZjBC63KKB7eWOTDjQ== (10.1.10.251) org.springframework.security.core.userdetails.UsernameNotFoundException: User monitor not found in directory.         at PluginClassLoader for ldap //org.springframework.security.ldap.search.FilterBasedLdapUserSearch.searchForUser(FilterBasedLdapUserSearch.java:107)         at PluginClassLoader for ldap //hudson.security.LDAPSecurityRealm$LDAPUserDetailsService.loadUserByUsername(LDAPSecurityRealm.java:1298)         at PluginClassLoader for ldap //hudson.security.LDAPSecurityRealm$DelegateLDAPUserDetailsService.loadUserByUsername(LDAPSecurityRealm.java:1220)         at PluginClassLoader for ldap //hudson.security.LDAPSecurityRealm$LDAPAuthenticationManager.authenticate(LDAPSecurityRealm.java:1009) ... + 56 more lines

            Unassigned Unassigned
            ollaw Gabriele
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: