directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [directory-server] 01/03: o Call the unbind method in a finally o Added some LOG message
Date Thu, 09 May 2019 22:40:21 GMT
This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git

commit ae298c1ee22c0b1d16d5a9a2930415aabd18b149
Author: emmanuel lecharny <elecharny@apache.org>
AuthorDate: Wed May 8 00:56:24 2019 +0200

    o Call the unbind method in a finally
    o Added some LOG message
---
 .../server/core/authn/DelegatingAuthenticator.java          | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
b/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
index 1dd8773..b58e6c5 100644
--- a/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
+++ b/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
@@ -283,9 +283,6 @@ public class DelegatingAuthenticator extends AbstractAuthenticator
             try
             {
                 ldapConnection.bind( bindDn, Strings.utf8ToString( bindContext.getCredentials()
) );
-
-                // no need to remain bound to delegate host
-                ldapConnection.unBind();
             }
             catch ( LdapException le )
             {
@@ -293,6 +290,16 @@ public class DelegatingAuthenticator extends AbstractAuthenticator
                 LOG.info( message );
                 throw new LdapAuthenticationException( message );
             }
+            finally
+            {
+                // no need to remain bound to delegate host
+                ldapConnection.unBind();
+
+                if ( IS_DEBUG )
+                {
+                    LOG.debug( "Authenticated successfully {}", bindContext.getDn() );
+                }
+            }
 
             // Create the new principal
             principal = new LdapPrincipal( getDirectoryService().getSchemaManager(), bindDn,


Mime
View raw message