You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/02/22 17:13:55 UTC
svn commit: r912642 - in
/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api:
LdapConnection.java LdapConnectionConfig.java
Author: elecharny
Date: Mon Feb 22 16:13:55 2010
New Revision: 912642
URL: http://svn.apache.org/viewvc?rev=912642&view=rev
Log:
o Removed the Bind method which take a byte[] for the credentials : one who want to send a byte[] will have to create a BindRequest object.
o Changed the LdapConnection config to take a String for credentials instead of byte[]
Modified:
directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java?rev=912642&r1=912641&r2=912642&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java (original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java Mon Feb 22 16:13:55 2010
@@ -941,7 +941,12 @@
{
LOG.debug( "Anonymous Bind request" );
- return bind( StringTools.EMPTY, StringTools.EMPTY_BYTES );
+ // Create the BindRequest
+ BindRequest bindRequest = new BindRequest();
+ bindRequest.setName( StringTools.EMPTY );
+ bindRequest.setCredentials( StringTools.EMPTY_BYTES );
+
+ return bind( bindRequest );
}
@@ -954,39 +959,12 @@
{
LOG.debug( "Anonymous Bind request" );
- return bindAsync( StringTools.EMPTY, StringTools.EMPTY_BYTES );
- }
-
-
- /**
- * An Unauthenticated Authentication Bind on a server. (cf RFC 4513,
- * par 5.1.2)
- *
- * @param name The name we use to authenticate the user. It must be a
- * valid DN
- * @return The BindResponse LdapResponse
- *
- public BindResponse bind( String name ) throws Exception
- {
- LOG.debug( "Bind request : {}", name );
-
- return bind( name, StringTools.EMPTY_BYTES );
- }
-
-
- /**
- * An Unauthenticated Authentication asynchronous Bind on a server. (cf RFC 4513,
- * par 5.1.2)
- *
- * @param name The name we use to authenticate the user. It must be a
- * valid DN
- * @return The BindFuture
- *
- public BindFuture bindAsync( String name ) throws Exception
- {
- LOG.debug( "Bind request : {}", name );
+ // Create the BindRequest
+ BindRequest bindRequest = new BindRequest();
+ bindRequest.setName( StringTools.EMPTY );
+ bindRequest.setCredentials( StringTools.EMPTY_BYTES );
- return bindAsync( name, StringTools.EMPTY_BYTES );
+ return bindAsync( bindRequest );
}
@@ -1002,7 +980,12 @@
{
LOG.debug( "Bind request : {}", name );
- return bind( name, StringTools.getBytesUtf8( credentials ) );
+ // Create the BindRequest
+ BindRequest bindRequest = new BindRequest();
+ bindRequest.setName( name );
+ bindRequest.setCredentials( StringTools.getBytesUtf8( credentials ) );
+
+ return bind( bindRequest );
}
@@ -1017,8 +1000,13 @@
public BindFuture bindAsync( String name, String credentials ) throws LdapException, IOException
{
LOG.debug( "Bind request : {}", name );
+
+ // Create the BindRequest
+ BindRequest bindRequest = new BindRequest();
+ bindRequest.setName( name );
+ bindRequest.setCredentials( StringTools.getBytesUtf8( credentials ) );
- return bindAsync( name, StringTools.getBytesUtf8( credentials ) );
+ return bindAsync( bindRequest );
}
@@ -1034,37 +1022,20 @@
{
LOG.debug( "Bind request : {}", name );
- if ( name == null )
- {
- return bind( StringTools.EMPTY, StringTools.getBytesUtf8( credentials ) );
- }
- else
- {
- return bind( name.getName(), StringTools.getBytesUtf8( credentials ) );
- }
- }
-
-
- /**
- * Simple asynchronous Bind on a server.
- *
- * @param name The name we use to authenticate the user. It must be a
- * valid DN
- * @param credentials The password. It can't be null
- * @return The BindResponse LdapResponse
- */
- public BindFuture bindAsync( LdapDN name, String credentials ) throws LdapException, IOException
- {
- LOG.debug( "Bind request : {}", name );
+ // Create the BindRequest
+ BindRequest bindRequest = new BindRequest();
+ bindRequest.setCredentials( StringTools.getBytesUtf8( credentials ) );
if ( name == null )
{
- return bindAsync( StringTools.EMPTY, StringTools.getBytesUtf8( credentials ) );
+ bindRequest.setName( StringTools.EMPTY );
}
else
{
- return bindAsync( name.getName(), StringTools.getBytesUtf8( credentials ) );
+ bindRequest.setName( name.getName() );
}
+
+ return bind( bindRequest );
}
@@ -1076,85 +1047,24 @@
* @param credentials The password. It can't be null
* @return The BindResponse LdapResponse
*/
- public BindFuture bindAsync( LdapDN name, byte[] credentials ) throws LdapException, IOException
+ public BindFuture bindAsync( LdapDN name, String credentials ) throws LdapException, IOException
{
LOG.debug( "Bind request : {}", name );
- if ( name == null )
- {
- return bindAsync( StringTools.EMPTY, credentials );
- }
- else
- {
- return bindAsync( name.getName(), credentials );
- }
- }
-
-
- /**
- * Simple Bind on a server.
- *
- * @param name The name we use to authenticate the user.
- * @param credentials The password.
- * @return The BindResponse LdapResponse
- */
- public BindResponse bind( LdapDN name, byte[] credentials ) throws LdapException, IOException
- {
- LOG.debug( "Bind request : {}", name );
+ // Create the BindRequest
+ BindRequest bindRequest = new BindRequest();
+ bindRequest.setCredentials( StringTools.getBytesUtf8( credentials ) );
if ( name == null )
{
- return bind( StringTools.EMPTY, credentials );
+ bindRequest.setName( StringTools.EMPTY );
}
else
{
- return bind( name.getName(), credentials );
+ bindRequest.setName( name.getName() );
}
- }
-
-
- /**
- * Simple Bind on a server.
- *
- * @param name The name we use to authenticate the user. It must be a
- * valid DN
- * @param credentials The password.
- * @return The BindResponse LdapResponse
- */
- public BindResponse bind( String name, byte[] credentials )
- throws LdapException, IOException
- {
- LOG.debug( "Bind request : {}", name );
-
- // Create the BindRequest
- BindRequest bindRequest = new BindRequest();
- bindRequest.setName( name );
- bindRequest.setCredentials( credentials );
-
- return bind( bindRequest );
- }
-
-
- /**
- * Asynchronous Simple Bind on a server.
- *
- * @param name The name we use to authenticate the user. It must be a
- * valid DN
- * @param credentials The password.
- * @return The BindFuture
- */
- public BindFuture bindAsync( String name, byte[] credentials ) throws LdapException, IOException
- {
- LOG.debug( "Bind request : {}", name );
-
- // Create the BindRequest
- BindRequest bindRequest = new BindRequest();
- bindRequest.setName( name );
- bindRequest.setCredentials( credentials );
-
- BindFuture bindFuture = bindAsync( bindRequest );
-
- return bindFuture;
+
+ return bindAsync( bindRequest );
}
Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java?rev=912642&r1=912641&r2=912642&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java (original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java Mon Feb 22 16:13:55 2010
@@ -67,7 +67,7 @@
private String name;
/** user's credentials ( current implementation supports password only); it must be a non-null value */
- private byte[] credentials;
+ private String credentials;
/** an array of key managers, if set, will be used while initializing the SSL context */
private KeyManager[] keyManagers;
@@ -129,13 +129,13 @@
}
- public byte[] getCredentials()
+ public String getCredentials()
{
return credentials;
}
- public void setCredentials( byte[] credentials )
+ public void setCredentials( String credentials )
{
this.credentials = credentials;
}