Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9146AE63A for ; Thu, 14 Feb 2013 11:09:16 +0000 (UTC) Received: (qmail 31047 invoked by uid 500); 14 Feb 2013 11:09:16 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 30991 invoked by uid 500); 14 Feb 2013 11:09:16 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 30979 invoked by uid 99); 14 Feb 2013 11:09:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2013 11:09:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2013 11:09:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B3AAD238896F; Thu, 14 Feb 2013 11:08:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1446117 - /directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/BindRequestHandler.java Date: Thu, 14 Feb 2013 11:08:53 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130214110853.B3AAD238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Thu Feb 14 11:08:53 2013 New Revision: 1446117 URL: http://svn.apache.org/r1446117 Log: Declared a variable directoryService to avoid many indirections Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/BindRequestHandler.java Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/BindRequestHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/BindRequestHandler.java?rev=1446117&r1=1446116&r2=1446117&view=diff ============================================================================== --- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/BindRequestHandler.java (original) +++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/BindRequestHandler.java Thu Feb 14 11:08:53 2013 @@ -92,6 +92,8 @@ public class BindRequestHandler extends @SuppressWarnings("PMD.EmptyCatchBlock") public void handleSimpleAuth( LdapSession ldapSession, BindRequest bindRequest ) throws Exception { + DirectoryService directoryService = ldapServer.getDirectoryService(); + // if the user is already bound, we have to unbind him if ( ldapSession.isAuthenticated() ) { @@ -113,7 +115,7 @@ public class BindRequestHandler extends bindContext.setDn( bindRequest.getDn() ); bindContext.setCredentials( bindRequest.getCredentials() ); bindContext.setIoSession( ldapSession.getIoSession() ); - bindContext.setInterceptors( ldapServer.getDirectoryService().getInterceptors( OperationEnum.BIND ) ); + bindContext.setInterceptors( directoryService.getInterceptors( OperationEnum.BIND ) ); // Stores the request controls into the operation context LdapProtocolUtils.setRequestControls( bindContext, bindRequest ); @@ -141,7 +143,7 @@ public class BindRequestHandler extends try { - principalEntry = getLdapServer().getDirectoryService().getAdminSession().lookup( bindRequest.getDn() ); + principalEntry = directoryService.getAdminSession().lookup( bindRequest.getDn() ); } catch ( LdapException le ) { @@ -172,8 +174,8 @@ public class BindRequestHandler extends // opContext.setEntry( principalEntry ); // And call the OperationManager bind operation. - bindContext.setInterceptors( getLdapServer().getDirectoryService().getInterceptors( OperationEnum.BIND ) ); - getLdapServer().getDirectoryService().getOperationManager().bind( bindContext ); + bindContext.setInterceptors( directoryService.getInterceptors( OperationEnum.BIND ) ); + directoryService.getOperationManager().bind( bindContext ); // As a result, store the created session in the Core Session ldapSession.setCoreSession( bindContext.getSession() ); @@ -341,7 +343,7 @@ public class BindRequestHandler extends // Build the response result.setResultCode( ResultCodeEnum.SASL_BIND_IN_PROGRESS ); - BindResponse resp = ( BindResponse ) bindRequest.getResultResponse(); + BindResponse resp = bindRequest.getResultResponse(); // Store the challenge resp.setServerSaslCreds( tokenBytes ); @@ -421,7 +423,7 @@ public class BindRequestHandler extends private void sendBindSuccess( LdapSession ldapSession, BindRequest bindRequest, byte[] tokenBytes ) { // Return the successful response - BindResponse response = ( BindResponse ) bindRequest.getResultResponse(); + BindResponse response = bindRequest.getResultResponse(); response.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS ); response.setServerSaslCreds( tokenBytes );