You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2016/09/13 00:57:48 UTC

[1/2] archiva-redback-core git commit: Fixing bind issue with certain ldap servers, when user not found

Repository: archiva-redback-core
Updated Branches:
  refs/heads/master 8e98a8aa9 -> 11b2cdbae


Fixing bind issue with certain ldap servers, when user not found

Subsequent calls of NamingResult#hasMoreElements returns different values in some
environments and situations.
e.g. it occured on IBM JDK 7 with Windows Active Directory LDAP when the first value of 'hasMoreElements'
was false.
The first value is cached now.


Project: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/commit/5ce2714a
Tree: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/tree/5ce2714a
Diff: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/diff/5ce2714a

Branch: refs/heads/master
Commit: 5ce2714a373ece65661bfd769698ee755b641f5b
Parents: c02519d
Author: Martin Stockhammer <m....@web.de>
Authored: Fri Sep 9 10:03:27 2016 +0200
Committer: Martin Stockhammer <m....@web.de>
Committed: Fri Sep 9 10:03:27 2016 +0200

----------------------------------------------------------------------
 .../ldap/LdapBindAuthenticator.java             | 21 +++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva-redback-core/blob/5ce2714a/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/apache/archiva/redback/authentication/ldap/LdapBindAuthenticator.java
----------------------------------------------------------------------
diff --git a/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/apache/archiva/redback/authentication/ldap/LdapBindAuthenticator.java b/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/apache/archiva/redback/authentication/ldap/LdapBindAuthenticator.java
index c79fb82..648b2f9 100644
--- a/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/apache/archiva/redback/authentication/ldap/LdapBindAuthenticator.java
+++ b/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/apache/archiva/redback/authentication/ldap/LdapBindAuthenticator.java
@@ -122,18 +122,25 @@ public class LdapBindAuthenticator
 
                 results = context.search( mapper.getUserBaseDn(), filter, ctls );
 
-                log.debug( "Found user '{}': {}", source.getUsername(), results.hasMoreElements() );
+                boolean moreElements = results.hasMoreElements();
 
-                if ( results.hasMoreElements() )
+                log.debug( "Found user '{}': {}", source.getUsername(), moreElements );
+
+                if ( moreElements )
                 {
-                    SearchResult result = results.nextElement();
+                    try {
+                        SearchResult result = results.nextElement();
 
-                    userDn = result.getNameInNamespace();
+                        userDn = result.getNameInNamespace();
 
-                    log.debug( "Adding userDn {} for user {} to the cache..", userDn, source.getUsername() );
+                        log.debug("Adding userDn {} for user {} to the cache..", userDn, source.getUsername());
 
-                    // REDBACK-289/MRM-1488 cache the ldap user's userDn to lessen calls to ldap server
-                    ldapCacheService.addLdapUserDn( source.getUsername(), userDn );
+                        // REDBACK-289/MRM-1488 cache the ldap user's userDn to lessen calls to ldap server
+                        ldapCacheService.addLdapUserDn(source.getUsername(), userDn);
+                    } catch (Exception e) {
+                        log.error("Error occured on LDAP result retrieval: {}, {}", userDn, e.getMessage());
+                        return new AuthenticationResult( false, source.getUsername(), e);
+                    }
                 }
                 else
                 {


[2/2] archiva-redback-core git commit: Merge branch 'pr/10' [MRM-1923] merge pr

Posted by ol...@apache.org.
Merge branch 'pr/10'
[MRM-1923] merge pr


Project: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/commit/11b2cdba
Tree: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/tree/11b2cdba
Diff: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/diff/11b2cdba

Branch: refs/heads/master
Commit: 11b2cdbae00e3f0d0ff8ff1fb0b374471de713da
Parents: 8e98a8a 5ce2714
Author: olivier lamy <ol...@apache.org>
Authored: Tue Sep 13 10:55:00 2016 +1000
Committer: olivier lamy <ol...@apache.org>
Committed: Tue Sep 13 10:55:00 2016 +1000

----------------------------------------------------------------------
 .../ldap/LdapBindAuthenticator.java             | 21 +++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------