directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r278636 - in /directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo: BindRequest.java LdapAuthentication.java SaslCredentials.java SimpleAuthentication.java
Date Sun, 04 Sep 2005 22:15:43 GMT
Author: elecharny
Date: Sun Sep  4 15:15:35 2005
New Revision: 278636

URL: http://svn.apache.org/viewcvs?rev=278636&view=rev
Log:
- Added logs 
- Added a parent class to authentication classes

Added:
    directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/LdapAuthentication.java
Modified:
    directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/BindRequest.java
    directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SaslCredentials.java
    directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SimpleAuthentication.java

Modified: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/BindRequest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/BindRequest.java?rev=278636&r1=278635&r2=278636&view=diff
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/BindRequest.java
(original)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/BindRequest.java
Sun Sep  4 15:15:35 2005
@@ -19,7 +19,6 @@
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
 
-import org.apache.asn1new.Asn1Object;
 import org.apache.asn1.codec.EncoderException;
 import org.apache.asn1new.ber.tlv.Length;
 import org.apache.asn1new.ber.tlv.Value;
@@ -45,7 +44,7 @@
     private LdapDN name;
 
     /** The authentication used to bind the user */
-    private Asn1Object authentication;
+    private LdapAuthentication authentication;
     
     /** The bind request length */
     private transient int bindRequestLength;
@@ -77,7 +76,7 @@
      *
      * @return The user authentication
      */
-    public Asn1Object getAuthentication()
+    public LdapAuthentication getAuthentication()
     {
         return authentication;
     }
@@ -107,7 +106,7 @@
      *
      * @param authentication The user authentication
      */
-    public void setAuthentication( Asn1Object authentication )
+    public void setAuthentication( LdapAuthentication authentication )
     {
         this.authentication = authentication;
     }

Added: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/LdapAuthentication.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/LdapAuthentication.java?rev=278636&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/LdapAuthentication.java
(added)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/LdapAuthentication.java
Sun Sep  4 15:15:35 2005
@@ -0,0 +1,29 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.asn1new.ldap.pojo;
+
+import org.apache.asn1new.Asn1Object;
+
+/**
+ * This abstract class is just used to have a common super class for
+ * authentication classes, like Simple and SASL. We may have future extensions
+ * as authentication type 1 and 2 are reserved actually in LDAP V3
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class LdapAuthentication extends Asn1Object {
+}

Modified: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SaslCredentials.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SaslCredentials.java?rev=278636&r1=278635&r2=278636&view=diff
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SaslCredentials.java
(original)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SaslCredentials.java
Sun Sep  4 15:15:35 2005
@@ -19,13 +19,14 @@
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
 
-import org.apache.asn1new.Asn1Object;
 import org.apache.asn1.codec.EncoderException;
 import org.apache.asn1new.ber.tlv.Length;
 import org.apache.asn1new.ber.tlv.Value;
 import org.apache.asn1new.primitives.OctetString;
 import org.apache.asn1new.ldap.codec.LdapConstants;
 import org.apache.asn1new.ldap.codec.primitives.LdapString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -33,8 +34,11 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SaslCredentials extends Asn1Object
+public class SaslCredentials extends LdapAuthentication
 {
+	/** The logger */
+    private static Logger log = LoggerFactory.getLogger( SimpleAuthentication.class );
+
     //~ Instance fields ----------------------------------------------------------------------------
 
     /** Any mechanism defined in RFC 2222 :
@@ -114,7 +118,12 @@
             saslLength += 1 + Length.getNbBytes( credentials.getLength() ) + credentials.getLength();
         }
         
-        return saslLength;
+    	if ( log.isDebugEnabled() )
+    	{
+    		log.debug( "SASL Authentication length : " + saslLength );
+    	}
+
+    	return saslLength;
     }
     
     /**
@@ -132,12 +141,13 @@
     {
         if ( buffer == null )
         {
+        	log.error( "Cannot put a PDU in a null buffer !" );
             throw new EncoderException( "Cannot put a PDU in a null buffer !" );
         }
 
         try 
         {
-            // The simpleAuthentication Tag
+            // The saslAuthentication Tag
             buffer.put( (byte)LdapConstants.BIND_REQUEST_SASL_TAG );
             buffer.put( Length.getBytes( mechanism.getLength() ) ) ;
             buffer.put( mechanism.getData() ) ;
@@ -149,6 +159,7 @@
         }
         catch ( BufferOverflowException boe )
         {
+        	log.error( "The PDU buffer size is too small !" );
             throw new EncoderException("The PDU buffer size is too small !"); 
         }
 

Modified: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SimpleAuthentication.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SimpleAuthentication.java?rev=278636&r1=278635&r2=278636&view=diff
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SimpleAuthentication.java
(original)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SimpleAuthentication.java
Sun Sep  4 15:15:35 2005
@@ -19,11 +19,12 @@
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
 
-import org.apache.asn1new.Asn1Object;
 import org.apache.asn1.codec.EncoderException;
 import org.apache.asn1new.ber.tlv.Length;
 import org.apache.asn1new.primitives.OctetString;
 import org.apache.asn1new.ldap.codec.LdapConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -31,8 +32,11 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SimpleAuthentication extends Asn1Object
+public class SimpleAuthentication  extends LdapAuthentication
 {
+	/** The logger */
+    private static Logger log = LoggerFactory.getLogger( SimpleAuthentication.class );
+
     //~ Instance fields ----------------------------------------------------------------------------
 
     /** The simple authentication password */
@@ -73,7 +77,14 @@
      */
     public int computeLength()
     {
-        return 1 + Length.getNbBytes( simple.getLength() ) + simple.getLength();
+    	int length = 1 + Length.getNbBytes( simple.getLength() ) + simple.getLength();
+
+    	if ( log.isDebugEnabled() )
+    	{
+    		log.debug( "Simple Authentication length : " + length );
+    	}
+
+    	return length;
     }
     
     /**
@@ -90,6 +101,7 @@
     {
         if ( buffer == null )
         {
+        	log.error( "Cannot put a PDU in a null buffer !" );
             throw new EncoderException( "Cannot put a PDU in a null buffer !" );
         }
 
@@ -102,6 +114,7 @@
         }
         catch ( BufferOverflowException boe )
         {
+        	log.error( "The PDU buffer size is too small !" );
             throw new EncoderException("The PDU buffer size is too small !"); 
         }
 



Mime
View raw message