directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r441270 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java
Date Thu, 07 Sep 2006 22:29:55 GMT
Author: elecharny
Date: Thu Sep  7 15:29:54 2006
New Revision: 441270

URL: http://svn.apache.org/viewvc?view=rev&rev=441270
Log:
Added the authenticationDecorator into the class,
fixed the encode method,
pointed to the Encoder and Decoder interfaces 

Modified:
    directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java

Modified: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java?view=diff&rev=441270&r1=441269&r2=441270
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java
(original)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/asn1ber/messages/bind/BindRequestAsn1Ber.java
Thu Sep  7 15:29:54 2006
@@ -22,14 +22,17 @@
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
 
-import org.apache.directory.shared.asn1.ber.Decoder;
-import org.apache.directory.shared.asn1.ber.Encoder;
 import org.apache.directory.shared.asn1.ber.tlv.Length;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.ldap.codec.asn1ber.messages.EncoderException;
+import org.apache.directory.shared.asn1.ber.tlv.ValueException;
+import org.apache.directory.shared.ldap.codec.Decoder;
+import org.apache.directory.shared.ldap.codec.Encoder;
+import org.apache.directory.shared.ldap.codec.EncoderException;
 import org.apache.directory.shared.ldap.codec.asn1ber.messages.LdapBerTags;
 import org.apache.directory.shared.ldap.messages.Message;
+import org.apache.directory.shared.ldap.messages.bind.Authentication;
 import org.apache.directory.shared.ldap.messages.bind.AuthenticationDecorator;
+import org.apache.directory.shared.ldap.messages.bind.BindRequest;
 import org.apache.directory.shared.ldap.messages.bind.BindRequestDecorator;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.slf4j.Logger;
@@ -53,6 +56,9 @@
     /** The bind request length */
     private transient int bindRequestLength;
     
+    /** The authentication decorator */
+    private transient AuthenticationDecorator authenticationDecorator;
+    
     /**
      * 
      * Creates a new instance of BindRequestAsn1Ber.
@@ -62,6 +68,16 @@
     public BindRequestAsn1Ber( Message message )
     {
         super( message );
+        Authentication authentication = ((BindRequest)message).getAuthentication();
+        
+        if ( authentication.isSimple() )
+        {
+            authenticationDecorator = new SimpleAuthenticationAsn1Ber( authentication );
+        }
+        else
+        {
+            authenticationDecorator = new SaslCredentialsAsn1Ber( authentication );
+        }
     }
 
     /**
@@ -129,7 +145,7 @@
      * @param buffer The buffer where to put the PDU
      * @return The PDU.
      */
-    public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+    public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException, ValueException
     {
         if ( buffer == null )
         {
@@ -149,13 +165,13 @@
         }
 
         // The version
-        Value.encode( buffer, getVersion() );
+        Value.encode(  buffer, getVersion() );
 
         // The name
-        Value.encode( buffer, LdapDN.getBytes( getName() ) );
+        Value.encode( buffer, LdapDN.getBytes( (LdapDN)getName() ) );
 
         // The authentication
-        getAuthentication().encode( buffer );
+        authenticationDecorator.encode( buffer );
 
         return buffer;
     }



Mime
View raw message