directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r587624 - in /directory/apacheds/branches/bigbang: kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/ kerberos-shared/s...
Date Tue, 23 Oct 2007 19:22:10 GMT
Author: elecharny
Date: Tue Oct 23 12:22:08 2007
New Revision: 587624

URL: http://svn.apache.org/viewvc?rev=587624&view=rev
Log:
Injected PaData implementation instead of PreAuthenticationData. Added some tests

Added:
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PaData.java
      - copied, changed from r587046, directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationData.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/PaDataType.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/PaDataTest.java
Removed:
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationData.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationDataModifier.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationDataType.java
Modified:
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcReplyDecoder.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcRequestDecoder.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PreAuthenticationDataDecoder.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcReplyEncoder.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/PreAuthenticationDataEncoder.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/AuthenticationReply.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/KdcReply.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/KdcRequest.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/TicketGrantReply.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifierBase.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifyEncryptedTimestamp.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifySam.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/GetAuthHeader.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractAuthenticationServiceTest.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcReplyDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcReplyDecoder.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcReplyDecoder.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcReplyDecoder.java Tue Oct 23 12:22:08 2007
@@ -31,7 +31,7 @@
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosPrincipalModifier;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DEREncodable;
@@ -82,7 +82,7 @@
     private KdcReply decodeKdcReplySequence( DERSequence sequence ) throws IOException
     {
         MessageType msgType = MessageType.NULL;
-        PreAuthenticationData[] paData = null;
+        PaData[] paData = null;
         Ticket ticket = null;
         EncryptedData encPart = null;
 

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcRequestDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcRequestDecoder.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcRequestDecoder.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcRequestDecoder.java Tue Oct 23 12:22:08 2007
@@ -27,7 +27,7 @@
 import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
 import org.apache.directory.server.kerberos.shared.messages.MessageType;
 import org.apache.directory.server.kerberos.shared.messages.value.KdcOptions;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBody;
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBodyModifier;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
@@ -81,7 +81,7 @@
         int pvno = 5;
         MessageType msgType = MessageType.NULL;
 
-        PreAuthenticationData[] paData = null;
+        PaData[] paData = null;
         RequestBody requestBody = null;
         byte[] bodyBytes = null;
 

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PreAuthenticationDataDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PreAuthenticationDataDecoder.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PreAuthenticationDataDecoder.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PreAuthenticationDataDecoder.java Tue Oct 23 12:22:08 2007
@@ -23,9 +23,8 @@
 import java.io.IOException;
 import java.util.Enumeration;
 
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataModifier;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataType;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DEREncodable;
 import org.apache.directory.shared.asn1.der.DERInteger;
@@ -41,13 +40,13 @@
 public class PreAuthenticationDataDecoder
 {
     /**
-     * Decodes a byte array into {@link PreAuthenticationData}.
+     * Decodes a byte array into {@link PaData}.
      *
      * @param encodedPreAuthData
-     * @return The {@link PreAuthenticationData}.
+     * @return The {@link PaData}.
      * @throws IOException
      */
-    public PreAuthenticationData decode( byte[] encodedPreAuthData ) throws IOException
+    public PaData decode( byte[] encodedPreAuthData ) throws IOException
     {
         ASN1InputStream ais = new ASN1InputStream( encodedPreAuthData );
 
@@ -65,15 +64,16 @@
      *            req-body[4]           KDC-REQ-BODY
      * }
      */
-    protected static PreAuthenticationData[] decodeSequence( DERSequence sequence )
+    protected static PaData[] decodeSequence( DERSequence sequence )
     {
-        PreAuthenticationData[] paDataSequence = new PreAuthenticationData[sequence.size()];
+        PaData[] paDataSequence = new PaData[sequence.size()];
 
         int ii = 0;
-        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        
+        for ( Enumeration<DEREncodable> e = sequence.getObjects(); e.hasMoreElements(); )
         {
             DERSequence object = ( DERSequence ) e.nextElement();
-            PreAuthenticationData paData = PreAuthenticationDataDecoder.decode( object );
+            PaData paData = PreAuthenticationDataDecoder.decode( object );
             paDataSequence[ii] = paData;
             ii++;
         }
@@ -89,11 +89,11 @@
      *                          -- might be encoded AP-REQ
      * }
      */
-    protected static PreAuthenticationData decode( DERSequence sequence )
+    protected static PaData decode( DERSequence sequence )
     {
-        PreAuthenticationDataModifier modifier = new PreAuthenticationDataModifier();
+        PaData paData = new PaData();
 
-        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        for ( Enumeration<DEREncodable> e = sequence.getObjects(); e.hasMoreElements(); )
         {
             DERTaggedObject object = ( DERTaggedObject ) e.nextElement();
             int tag = object.getTagNo();
@@ -103,16 +103,16 @@
             {
                 case 1:
                     DERInteger padataType = ( DERInteger ) derObject;
-                    PreAuthenticationDataType type = PreAuthenticationDataType.getTypeByOrdinal( padataType.intValue() );
-                    modifier.setDataType( type );
+                    PaDataType type = PaDataType.getTypeByOrdinal( padataType.intValue() );
+                    paData.setPaDataType( type );
                     break;
                 case 2:
                     DEROctetString padataValue = ( DEROctetString ) derObject;
-                    modifier.setDataValue( padataValue.getOctets() );
+                    paData.setPaDataValue( padataValue.getOctets() );
                     break;
             }
         }
 
-        return modifier.getPreAuthenticationData();
+        return paData;
     }
 }

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcReplyEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcReplyEncoder.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcReplyEncoder.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcReplyEncoder.java Tue Oct 23 12:22:08 2007
@@ -24,7 +24,7 @@
 import java.nio.ByteBuffer;
 
 import org.apache.directory.server.kerberos.shared.messages.KdcReply;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.shared.asn1.der.ASN1OutputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DERGeneralString;
@@ -102,7 +102,7 @@
      padata-value[2]       OCTET STRING,
      -- might be encoded AP-REQ
      }*/
-    private DERSequence encodePreAuthData( PreAuthenticationData[] preAuthData )
+    private DERSequence encodePreAuthData( PaData[] preAuthData )
     {
         DERSequence preAuth = new DERSequence();
 
@@ -110,8 +110,8 @@
         {
             DERSequence sequence = new DERSequence();
 
-            sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( preAuthData[ii].getDataType().getOrdinal() ) ) );
-            sequence.add( new DERTaggedObject( 2, new DEROctetString( preAuthData[ii].getDataValue() ) ) );
+            sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( preAuthData[ii].getPaDataType().getOrdinal() ) ) );
+            sequence.add( new DERTaggedObject( 2, new DEROctetString( preAuthData[ii].getPaDataValue() ) ) );
             preAuth.add( sequence );
         }
 

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java Tue Oct 23 12:22:08 2007
@@ -25,7 +25,7 @@
 import java.nio.ByteBuffer;
 
 import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBody;
 import org.apache.directory.shared.asn1.der.ASN1OutputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
@@ -198,7 +198,7 @@
      padata-value[2]       OCTET STRING,
      -- might be encoded AP-REQ
      }*/
-    private DERSequence encodePreAuthData( PreAuthenticationData[] preAuthData )
+    private DERSequence encodePreAuthData( PaData[] preAuthData )
     {
         DERSequence preAuth = new DERSequence();
 
@@ -206,8 +206,8 @@
         {
             DERSequence sequence = new DERSequence();
 
-            sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( preAuthData[ii].getDataType().getOrdinal() ) ) );
-            sequence.add( new DERTaggedObject( 2, new DEROctetString( preAuthData[ii].getDataValue() ) ) );
+            sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( preAuthData[ii].getPaDataType().getOrdinal() ) ) );
+            sequence.add( new DERTaggedObject( 2, new DEROctetString( preAuthData[ii].getPaDataValue() ) ) );
             preAuth.add( sequence );
         }
 

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/PreAuthenticationDataEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/PreAuthenticationDataEncoder.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/PreAuthenticationDataEncoder.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/PreAuthenticationDataEncoder.java Tue Oct 23 12:22:08 2007
@@ -23,7 +23,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.shared.asn1.der.ASN1OutputStream;
 import org.apache.directory.shared.asn1.der.DERInteger;
 import org.apache.directory.shared.asn1.der.DEROctetString;
@@ -38,13 +38,13 @@
 public class PreAuthenticationDataEncoder
 {
     /**
-     * Encodes an array of {@link PreAuthenticationData}s into a byte array.
+     * Encodes an array of {@link PaData}s into a byte array.
      *
      * @param preAuth
      * @return The byte array.
      * @throws IOException
      */
-    public static byte[] encode( PreAuthenticationData[] preAuth ) throws IOException
+    public static byte[] encode( PaData[] preAuth ) throws IOException
     {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ASN1OutputStream aos = new ASN1OutputStream( baos );
@@ -59,7 +59,7 @@
     /**
      * METHOD-DATA     ::= SEQUENCE OF PA-DATA
      */
-    protected static DERSequence encodeSequence( PreAuthenticationData[] preAuth )
+    protected static DERSequence encodeSequence( PaData[] preAuth )
     {
         DERSequence sequence = new DERSequence();
 
@@ -78,15 +78,15 @@
      *         padata-value[2]       OCTET STRING
      * }
      */
-    protected static DERSequence encode( PreAuthenticationData preAuth )
+    protected static DERSequence encode( PaData preAuth )
     {
         DERSequence sequence = new DERSequence();
 
-        sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( preAuth.getDataType().getOrdinal() ) ) );
+        sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( preAuth.getPaDataType().getOrdinal() ) ) );
 
-        if ( preAuth.getDataValue() != null )
+        if ( preAuth.getPaDataValue() != null )
         {
-            sequence.add( new DERTaggedObject( 2, new DEROctetString( preAuth.getDataValue() ) ) );
+            sequence.add( new DERTaggedObject( 2, new DEROctetString( preAuth.getPaDataValue() ) ) );
         }
 
         return sequence;

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/AuthenticationReply.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/AuthenticationReply.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/AuthenticationReply.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/AuthenticationReply.java Tue Oct 23 12:22:08 2007
@@ -24,7 +24,7 @@
 
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 
 
 /**
@@ -50,7 +50,7 @@
      * @param ticket
      * @param encPart
      */
-    public AuthenticationReply( PreAuthenticationData[] paData, KerberosPrincipal clientPrincipal, Ticket ticket,
+    public AuthenticationReply( PaData[] paData, KerberosPrincipal clientPrincipal, Ticket ticket,
         EncryptedData encPart )
     {
         super( paData, clientPrincipal, ticket, encPart, MessageType.KRB_AS_REP );

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/KdcReply.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/KdcReply.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/KdcReply.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/KdcReply.java Tue Oct 23 12:22:08 2007
@@ -29,7 +29,7 @@
 import org.apache.directory.server.kerberos.shared.messages.value.HostAddresses;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
 import org.apache.directory.server.kerberos.shared.messages.value.LastRequest;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.server.kerberos.shared.messages.value.TicketFlags;
 
 
@@ -39,7 +39,7 @@
  */
 public class KdcReply extends KerberosMessage implements Encodable
 {
-    private PreAuthenticationData[] paData; //optional
+    private PaData[] paData; //optional
     private KerberosPrincipal clientPrincipal;
     private Ticket ticket;
 
@@ -67,7 +67,7 @@
      * @param encPart
      * @param msgType
      */
-    public KdcReply( PreAuthenticationData[] paData, KerberosPrincipal clientPrincipal, Ticket ticket,
+    public KdcReply( PaData[] paData, KerberosPrincipal clientPrincipal, Ticket ticket,
         EncryptedData encPart, MessageType msgType )
     {
         this( msgType );
@@ -112,11 +112,11 @@
 
 
     /**
-     * Returns an array of {@link PreAuthenticationData}s.
+     * Returns an array of {@link PaData}s.
      *
-     * @return The array of {@link PreAuthenticationData}s.
+     * @return The array of {@link PaData}s.
      */
-    public PreAuthenticationData[] getPaData()
+    public PaData[] getPaData()
     {
         return paData;
     }
@@ -167,11 +167,11 @@
 
 
     /**
-     * Sets the array of {@link PreAuthenticationData}s.
+     * Sets the array of {@link PaData}s.
      *
      * @param data
      */
-    public void setPaData( PreAuthenticationData[] data )
+    public void setPaData( PaData[] data )
     {
         paData = data;
     }

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/KdcRequest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/KdcRequest.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/KdcRequest.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/KdcRequest.java Tue Oct 23 12:22:08 2007
@@ -28,7 +28,7 @@
 import org.apache.directory.server.kerberos.shared.messages.value.HostAddresses;
 import org.apache.directory.server.kerberos.shared.messages.value.KdcOptions;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBody;
 
 
@@ -38,7 +38,7 @@
  */
 public class KdcRequest extends KerberosMessage
 {
-    private PreAuthenticationData[] preAuthData; //optional
+    private PaData[] preAuthData; //optional
     private RequestBody requestBody;
     private byte[] bodyBytes;
 
@@ -51,7 +51,7 @@
      * @param preAuthData
      * @param requestBody
      */
-    public KdcRequest( int pvno, MessageType messageType, PreAuthenticationData[] preAuthData, RequestBody requestBody )
+    public KdcRequest( int pvno, MessageType messageType, PaData[] preAuthData, RequestBody requestBody )
     {
         super( pvno, messageType );
         this.preAuthData = preAuthData;
@@ -68,7 +68,7 @@
      * @param requestBody
      * @param bodyBytes
      */
-    public KdcRequest( int pvno, MessageType messageType, PreAuthenticationData[] preAuthData, RequestBody requestBody,
+    public KdcRequest( int pvno, MessageType messageType, PaData[] preAuthData, RequestBody requestBody,
         byte[] bodyBytes )
     {
         this( pvno, messageType, preAuthData, requestBody );
@@ -77,11 +77,11 @@
 
 
     /**
-     * Returns an array of {@link PreAuthenticationData}s.
+     * Returns an array of {@link PaData}s.
      *
-     * @return The array of {@link PreAuthenticationData}s.
+     * @return The array of {@link PaData}s.
      */
-    public PreAuthenticationData[] getPreAuthData()
+    public PaData[] getPreAuthData()
     {
         return preAuthData;
     }

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/TicketGrantReply.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/TicketGrantReply.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/TicketGrantReply.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/TicketGrantReply.java Tue Oct 23 12:22:08 2007
@@ -24,7 +24,7 @@
 
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 
 
 /**
@@ -50,7 +50,7 @@
      * @param ticket
      * @param encPart
      */
-    public TicketGrantReply( PreAuthenticationData[] pAData, KerberosPrincipal clientPrincipal, Ticket ticket,
+    public TicketGrantReply( PaData[] pAData, KerberosPrincipal clientPrincipal, Ticket ticket,
         EncryptedData encPart )
     {
         super( pAData, clientPrincipal, ticket, encPart, MessageType.KRB_TGS_REP );

Copied: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PaData.java (from r587046, directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationData.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PaData.java?p2=directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PaData.java&p1=directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationData.java&r1=587046&r2=587624&rev=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationData.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PaData.java Tue Oct 23 12:22:08 2007
@@ -20,47 +20,257 @@
 package org.apache.directory.server.kerberos.shared.messages.value;
 
 
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
+import org.apache.directory.shared.asn1.AbstractAsn1Object;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
+import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.ldap.util.StringTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
 /**
+ * The Pre-Authentication data. Tha ASN.1 GRAMMAR IS :
+ * 
+ * PA-DATA         ::= SEQUENCE {
+ *         -- NOTE: first tag is [1], not [0]
+ *         padata-type     [1] Int32,
+ *         padata-value    [2] OCTET STRING -- might be encoded AP-REQ
+ * }
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class PreAuthenticationData
+public class PaData extends AbstractAsn1Object
 {
-    private PreAuthenticationDataType dataType;
-    private byte[] dataValue;
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( PaData.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+    /** The Pre-authentication type */
+    private PaDataType paDataType;
+    
+    /** The authentication data */
+    private byte[] paDataValue;
+
+    // Storage for computed lengths
+    private transient int paDataTypeTagLength;
+    private transient int paDataValueTagLength;
+    private transient int preAuthenticationDataSeqLength;
+    
+
+    /**
+     * Creates a new instance of PreAuthenticationData.
+     *
+     * @param paDataType
+     * @param dataValue
+     */
+    public PaData()
+    {
+    }
 
+    
     /**
      * Creates a new instance of PreAuthenticationData.
      *
-     * @param dataType
+     * @param paDataType
      * @param dataValue
      */
-    public PreAuthenticationData( PreAuthenticationDataType dataType, byte[] dataValue )
+    public PaData( PaDataType paDataType, byte[] paDataValue )
     {
-        this.dataType = dataType;
-        this.dataValue = dataValue;
+        this.paDataType = paDataType;
+        this.paDataValue = paDataValue;
     }
 
 
     /**
-     * Returns the {@link PreAuthenticationDataType}.
+     * Returns the {@link PaDataType}.
+     *
+     * @return The {@link PaDataType}.
+     */
+    public PaDataType getPaDataType()
+    {
+        return paDataType;
+    }
+
+
+    /**
+     * Set the PA-DATA type
+     *
+     * @param paDataType The PA-DATA type
+     */
+    public void setPaDataType( int paDataType )
+    {
+        this.paDataType = PaDataType.getTypeByOrdinal( paDataType );
+    }
+
+    
+    /**
+     * Set the PA-DATA type
+     *
+     * @param paDataType The PA-DATA type
+     */
+    public void setPaDataType( PaDataType paDataType )
+    {
+        this.paDataType = paDataType;
+    }
+
+    
+    /**
+     * Returns the raw bytes of the {@link PaData}.
      *
-     * @return The {@link PreAuthenticationDataType}.
+     * @return The raw bytes of the {@link PaData}.
      */
-    public PreAuthenticationDataType getDataType()
+    public byte[] getPaDataValue()
     {
-        return dataType;
+        return paDataValue;
     }
 
 
     /**
-     * Returns the raw bytes of the {@link PreAuthenticationData}.
+     * Set the PA-DATA value
      *
-     * @return The raw bytes of the {@link PreAuthenticationData}.
+     * @param paDataValue The PA-DATA value
      */
-    public byte[] getDataValue()
+    public void setPaDataValue( byte[] paDataValue )
     {
-        return dataValue;
+        this.paDataValue = paDataValue;
+    }
+
+    
+    /**
+     * Compute the PreAuthenticationData length
+     * 
+     * PreAuthenticationData :
+     * 
+     * 0x30 L1 PreAuthenticationData sequence
+     *  |
+     *  +--> 0xA0 L2 padata-type tag
+     *  |     |
+     *  |     +--> 0x02 L2-1 padata-type (int)
+     *  |
+     *  +--> 0xA1 L3 padata-value tag
+     *        |
+     *        +--> 0x04 L3-1 padata-value (OCTET STRING)
+     *        
+     *  where L1 = L2 + lenght(0xA0) + length(L2) +
+     *             L3 + lenght(0xA1) + length(L3) 
+     *  and
+     *  L2 = L2-1 + length(0x02) + length( L2-1) 
+     *  L3 = L3-1 + length(0x04) + length( L3-1) 
+     */
+    public int computeLength()
+    {
+        // Compute the paDataType. The Length will always be contained in 1 byte
+        int paDataTypeLength = Value.getNbBytes( paDataType.getOrdinal() );
+        paDataTypeTagLength = 1 + TLV.getNbBytes( paDataTypeLength ) + paDataTypeLength;
+        preAuthenticationDataSeqLength = 1 + TLV.getNbBytes( paDataTypeTagLength ) + paDataTypeTagLength;
+
+        // Compute the paDataValue
+        if ( paDataValue == null )
+        {
+            paDataValueTagLength = 1 + 1;
+        }
+        else
+        {
+            paDataValueTagLength = 1 + TLV.getNbBytes( paDataValue.length ) + paDataValue.length;
+        }
+
+        // Compute the whole sequence length
+        preAuthenticationDataSeqLength += 1 + TLV.getNbBytes( paDataValueTagLength ) + paDataValueTagLength;
+
+        return 1 + TLV.getNbBytes( preAuthenticationDataSeqLength ) + preAuthenticationDataSeqLength;
+
+    }
+
+
+    /**
+     * Encode the PreAuthenticationData message to a PDU. 
+     * 
+     * PreAuthenticationData :
+     * 
+     * 0x30 LL
+     *   0xA0 LL 
+     *     0x02 0x01 padata-type
+     *   0xA1 LL 
+     *     0x04 LL padata-value
+     * 
+     * @param buffer The buffer where to put the PDU. It should have been allocated
+     * before, with the right size.
+     * @return The constructed PDU.
+     */
+    public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+    {
+        if ( buffer == null )
+        {
+            throw new EncoderException( "Cannot put a PDU in a null buffer !" );
+        }
+
+        try
+        {
+            // The Checksum SEQ Tag
+            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( TLV.getBytes( preAuthenticationDataSeqLength ) );
+
+            // The cksumtype, first the tag, then the value
+            buffer.put( ( byte ) 0xA1 );
+            buffer.put( TLV.getBytes( paDataTypeTagLength ) );
+            Value.encode( buffer, paDataType.getOrdinal() );
+
+            // The checksum, first the tag, then the value
+            buffer.put( ( byte ) 0xA2 );
+            buffer.put( TLV.getBytes( paDataValueTagLength ) );
+            Value.encode( buffer, paDataValue );
+        }
+        catch ( BufferOverflowException boe )
+        {
+            log.error( "Cannot encode the PreAuthenticationData object, the PDU size is {} when only {} bytes has been allocated", 1
+                + TLV.getNbBytes( preAuthenticationDataSeqLength ) + preAuthenticationDataSeqLength, buffer.capacity() );
+            throw new EncoderException( "The PDU buffer size is too small !" );
+        }
+
+        if ( IS_DEBUG )
+        {
+            log.debug( "PreAuthenticationData encoding : {}", StringTools.dumpBytes( buffer.array() ) );
+            log.debug( "PreAuthenticationData initial value : {}", toString() );
+        }
+
+        return buffer;
+    }
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return toString( "" );
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString( String tabs )
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( tabs ).append( "PreAuthenticationData : {\n" );
+        sb.append( tabs ).append( "    padata-type: " ).append( paDataType ).append( '\n' );
+
+        if ( paDataValue != null )
+        {
+            sb.append( tabs + "    padata-value:" ).append( StringTools.dumpBytes( paDataValue ) ).append( '\n' );
+        }
+
+        sb.append( tabs + "}\n" );
+
+        return sb.toString();
     }
 }

Added: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/PaDataType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/PaDataType.java?rev=587624&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/PaDataType.java (added)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/PaDataType.java Tue Oct 23 12:22:08 2007
@@ -0,0 +1,238 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.server.kerberos.shared.messages.value.types;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public enum PaDataType
+{
+    /**
+     * Constant for the "null" pre-authentication data type.
+     */
+    NULL( 0 ),
+
+    /**
+     * Constant for the "TGS request" pre-authentication data type.
+     */
+    PA_TGS_REQ( 1 ),
+
+    /**
+     * Constant for the "encrypted timestamp" pre-authentication data type.
+     */
+    PA_ENC_TIMESTAMP( 2 ),
+
+    /**
+     * Constant for the "password salt" pre-authentication data type.
+     */
+    PA_PW_SALT( 3 ),
+
+    /**
+     * Constant for the "enc unix time" pre-authentication data type.
+     */
+    PA_ENC_UNIX_TIME( 5 ),
+
+    /**
+     * Constant for the "sandia secureid" pre-authentication data type.
+     */
+    PA_SANDIA_SECUREID( 6 ),
+
+    /**
+     * Constant for the "sesame" pre-authentication data type.
+     */
+    PA_SESAME( 7 ),
+
+    /**
+     * Constant for the "OSF DCE" pre-authentication data type.
+     */
+    PA_OSF_DCE( 8 ),
+
+    /**
+     * Constant for the "cybersafe secureid" pre-authentication data type.
+     */
+    PA_CYBERSAFE_SECUREID( 9 ),
+
+    /**
+     * Constant for the "ASF3 salt" pre-authentication data type.
+     */
+    PA_ASF3_SALT( 10 ),
+
+    /**
+     * Constant for the "encryption info" pre-authentication data type.
+     */
+    PA_ENCTYPE_INFO( 11 ),
+
+    /**
+     * Constant for the "SAM challenge" pre-authentication data type.
+     */
+    SAM_CHALLENGE( 12 ),
+
+    /**
+     * Constant for the "SAM response" pre-authentication data type.
+     */
+    SAM_RESPONSE( 13 ),
+
+    /**
+     * Constant for the "PK as request" pre-authentication data type.
+     */
+    PA_PK_AS_REQ( 14 ),
+
+    /**
+     * Constant for the "PK as response" pre-authentication data type.
+     */
+    PA_PK_AS_REP( 15 ),
+
+    /**
+     * Constant for the "use specified key version" pre-authentication data type.
+     */
+    PA_USE_SPECIFIED_KVNO( 20 ),
+
+    /**
+     * Constant for the "SAM redirect" pre-authentication data type.
+     */
+    SAM_REDIRECT( 21 ),
+
+    /**
+     * Constant for the "get from typed data" pre-authentication data type.
+     */
+    PA_GET_FROM_TYPED_DATA( 22 );
+
+
+    /**
+     * The value/code for the pre-authentication type.
+     */
+    private final int ordinal;
+
+
+    /**
+     * Private constructor prevents construction outside of this class.
+     */
+    private PaDataType( int ordinal )
+    {
+        this.ordinal = ordinal;
+    }
+
+
+    /**
+     * Returns the number associated with this pre-authentication type.
+     *
+     * @return The pre-authentication type ordinal.
+     */
+    public int getOrdinal()
+    {
+        return ordinal;
+    }
+    
+    /**
+     * Returns the pre authentication data type when specified by its ordinal.
+     *
+     * @param type The ordinal
+     * @return The pre authentication type.
+     */
+    public static PaDataType getTypeByOrdinal( int type )
+    {
+        switch ( type )
+        {
+            case 1 :    return PA_TGS_REQ;
+            case 2 :    return PA_ENC_TIMESTAMP;
+            case 3 :    return PA_PW_SALT;
+            case 5 :    return PA_ENC_UNIX_TIME;
+            case 6 :    return PA_SANDIA_SECUREID;
+            case 7 :    return PA_SESAME;
+            case 8 :    return PA_OSF_DCE;
+            case 9 :    return PA_CYBERSAFE_SECUREID;
+            case 10 :   return PA_ASF3_SALT;
+            case 11 :   return PA_ENCTYPE_INFO;
+            case 12 :   return SAM_CHALLENGE;
+            case 13 :   return SAM_RESPONSE;
+            case 14 :   return PA_PK_AS_REQ;
+            case 15 :   return PA_PK_AS_REQ;
+            case 20 :   return PA_USE_SPECIFIED_KVNO;
+            case 21 :   return SAM_REDIRECT;
+            case 22 :   return PA_GET_FROM_TYPED_DATA;
+            default :   return NULL;
+        }
+    }
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        switch ( this )
+        {
+            case PA_TGS_REQ                     : 
+                return "TGS request." + "(" + ordinal + ")";
+            
+            case PA_ENC_TIMESTAMP : 
+                return "Encrypted timestamp." + "(" + ordinal + ")";
+            
+            case PA_PW_SALT : 
+                return "password salt" + "(" + ordinal + ")";
+            
+            case PA_ENC_UNIX_TIME : 
+                return "enc unix time" + "(" + ordinal + ")";
+            
+            case PA_SANDIA_SECUREID : 
+                return "sandia secureid" + "(" + ordinal + ")";
+            
+            case PA_SESAME : 
+                return "sesame" + "(" + ordinal + ")";
+            
+            case PA_OSF_DCE : 
+                return "OSF DCE" + "(" + ordinal + ")";
+            
+            case PA_CYBERSAFE_SECUREID : 
+                return "cybersafe secureid" + "(" + ordinal + ")";
+            
+            case PA_ASF3_SALT : 
+                return "ASF3 salt" + "(" + ordinal + ")";
+            
+            case PA_ENCTYPE_INFO : 
+                return "Encryption info." + "(" + ordinal + ")";
+            
+            case SAM_CHALLENGE : 
+                return "SAM challenge." + "(" + ordinal + ")";
+            
+            case SAM_RESPONSE : 
+                return "SAM response." + "(" + ordinal + ")";
+            
+            case PA_PK_AS_REQ : 
+                return "PK as request" + "(" + ordinal + ")";
+            
+            case PA_PK_AS_REP : 
+                return "PK as response" + "(" + ordinal + ")";
+                
+            case PA_USE_SPECIFIED_KVNO :
+                return "use specified key version" + "(" + ordinal + ")";
+            
+            case SAM_REDIRECT :
+                return "SAM redirect." + "(" + ordinal + ")";
+            
+            case PA_GET_FROM_TYPED_DATA :
+                return "Get from typed data" + "(" + ordinal + ")";
+            
+            default : 
+                return "null" + "(" + ordinal + ")";
+        }
+    }
+}
\ No newline at end of file

Added: directory/apacheds/branches/bigbang/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/PaDataTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/PaDataTest.java?rev=587624&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/PaDataTest.java (added)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/PaDataTest.java Tue Oct 23 12:22:08 2007
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.server.kerberos.shared.messages.value;
+
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Test the PaData encoding and decoding
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 542147 $, $Date: 2007-05-28 10:14:21 +0200 (Mon, 28 May 2007) $
+ */
+public class PaDataTest extends TestCase
+{
+    public void testEncodingPreAuthenticationData() throws Exception
+    {
+        PaData pad = new PaData( PaDataType.PA_ASF3_SALT, new byte[]
+            { 0x01, 0x02, 0x03 } );
+
+        ByteBuffer encoded = ByteBuffer.allocate( pad.computeLength() );
+
+        pad.encode( encoded );
+
+        byte[] expectedResult = new byte[]
+            { 
+            0x30, 0x0c, 
+              ( byte ) 0xA1, 0x03, 
+                0x02, 0x01, 0x0A, 
+              ( byte ) 0xA2, 0x05, 
+                0x04, 0x03, 
+                  0x01, 0x02, 0x03 
+            };
+
+        assertTrue( Arrays.equals( expectedResult, encoded.array() ) );
+    }
+
+
+    public void testEncodingNullPreAuthenticationData() throws Exception
+    {
+        PaData pad = new PaData( PaDataType.PA_ASF3_SALT, null );
+
+        ByteBuffer encoded = ByteBuffer.allocate( pad.computeLength() );
+
+        pad.encode( encoded );
+
+        byte[] expectedResult = new byte[]
+            { 
+                0x30, 0x09, 
+                  ( byte ) 0xA1, 0x03, 
+                    0x02, 0x01, 0x0A, 
+                  ( byte ) 0xA2, 0x02, 
+                    0x04, 0x00 
+            };
+
+        assertTrue( Arrays.equals( expectedResult, encoded.array() ) );
+    }
+}

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifierBase.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifierBase.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifierBase.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifierBase.java Tue Oct 23 12:22:08 2007
@@ -26,9 +26,8 @@
 import org.apache.directory.server.kerberos.shared.io.encoder.EncryptionTypeInfoEncoder;
 import org.apache.directory.server.kerberos.shared.io.encoder.PreAuthenticationDataEncoder;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionTypeInfoEntry;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataModifier;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataType;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.mina.handler.chain.IoHandlerCommand;
 
 
@@ -50,13 +49,13 @@
      */
     public byte[] preparePreAuthenticationError( EncryptionType[] encryptionTypes )
     {
-        PreAuthenticationData[] paDataSequence = new PreAuthenticationData[2];
+        PaData[] paDataSequence = new PaData[2];
 
-        PreAuthenticationDataModifier modifier = new PreAuthenticationDataModifier();
-        modifier.setDataType( PreAuthenticationDataType.PA_ENC_TIMESTAMP );
-        modifier.setDataValue( new byte[0] );
+        PaData paData = new PaData();
+        paData.setPaDataType( PaDataType.PA_ENC_TIMESTAMP );
+        paData.setPaDataValue( new byte[0] );
 
-        paDataSequence[0] = modifier.getPreAuthenticationData();
+        paDataSequence[0] = paData;
 
         EncryptionTypeInfoEntry[] entries = new EncryptionTypeInfoEntry[encryptionTypes.length];
         for ( int ii = 0; ii < encryptionTypes.length; ii++ )
@@ -75,11 +74,11 @@
             return null;
         }
 
-        PreAuthenticationDataModifier encTypeModifier = new PreAuthenticationDataModifier();
-        encTypeModifier.setDataType( PreAuthenticationDataType.PA_ETYPE_INFO );
-        encTypeModifier.setDataValue( encTypeInfo );
+        PaData encType = new PaData();
+        encType.setPaDataType( PaDataType.PA_ENCTYPE_INFO );
+        encType.setPaDataValue( encTypeInfo );
 
-        paDataSequence[1] = encTypeModifier.getPreAuthenticationData();
+        paDataSequence[1] = encType;
 
         try
         {

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifyEncryptedTimestamp.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifyEncryptedTimestamp.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifyEncryptedTimestamp.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifyEncryptedTimestamp.java Tue Oct 23 12:22:08 2007
@@ -34,8 +34,8 @@
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataType;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntry;
 import org.apache.mina.common.IoSession;
 import org.slf4j.Logger;
@@ -89,7 +89,7 @@
 
             if ( config.isPaEncTimestampRequired() )
             {
-                PreAuthenticationData[] preAuthData = request.getPreAuthData();
+                PaData[] preAuthData = request.getPreAuthData();
 
                 if ( preAuthData == null )
                 {
@@ -101,13 +101,13 @@
 
                 for ( int ii = 0; ii < preAuthData.length; ii++ )
                 {
-                    if ( preAuthData[ii].getDataType().equals( PreAuthenticationDataType.PA_ENC_TIMESTAMP ) )
+                    if ( preAuthData[ii].getPaDataType().equals( PaDataType.PA_ENC_TIMESTAMP ) )
                     {
                         EncryptedData dataValue;
 
                         try
                         {
-                            dataValue = EncryptedDataDecoder.decode( preAuthData[ii].getDataValue() );
+                            dataValue = EncryptedDataDecoder.decode( preAuthData[ii].getPaDataValue() );
                         }
                         catch ( IOException ioe )
                         {

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifySam.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifySam.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifySam.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/preauthentication/VerifySam.java Tue Oct 23 12:22:08 2007
@@ -32,8 +32,8 @@
 import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
 import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataType;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntry;
 import org.apache.mina.common.IoSession;
 import org.slf4j.Logger;
@@ -75,7 +75,7 @@
                 log.debug( "Entry for client principal {} has a valid SAM type.  Invoking SAM subsystem for pre-authentication.", clientName );
             }
 
-            PreAuthenticationData[] preAuthData = request.getPreAuthData();
+            PaData[] preAuthData = request.getPreAuthData();
 
             if ( preAuthData == null || preAuthData.length == 0 )
             {
@@ -87,10 +87,10 @@
             {
                 for ( int ii = 0; ii < preAuthData.length; ii++ )
                 {
-                    if ( preAuthData[ii].getDataType().equals( PreAuthenticationDataType.PA_ENC_TIMESTAMP ) )
+                    if ( preAuthData[ii].getPaDataType().equals( PaDataType.PA_ENC_TIMESTAMP ) )
                     {
                         KerberosKey samKey = SamSubsystem.getInstance().verify( clientEntry,
-                            preAuthData[ii].getDataValue() );
+                            preAuthData[ii].getPaDataValue() );
                         clientKey = new EncryptionKey( EncryptionType.getTypeByOrdinal( samKey.getKeyType() ), samKey
                             .getEncoded() );
                     }

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/GetAuthHeader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/GetAuthHeader.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/GetAuthHeader.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/ticketgrant/GetAuthHeader.java Tue Oct 23 12:22:08 2007
@@ -28,8 +28,8 @@
 import org.apache.directory.server.kerberos.shared.messages.ApplicationRequest;
 import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataType;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.handler.chain.IoHandlerCommand;
 
@@ -66,7 +66,7 @@
 
     protected ApplicationRequest getAuthHeader( KdcRequest request ) throws KerberosException, IOException
     {
-        PreAuthenticationData[] preAuthData = request.getPreAuthData();
+        PaData[] preAuthData = request.getPreAuthData();
 
         if ( preAuthData == null || preAuthData.length < 1 )
         {
@@ -77,9 +77,9 @@
 
         for ( int ii = 0; ii < preAuthData.length; ii++ )
         {
-            if ( preAuthData[ii].getDataType() == PreAuthenticationDataType.PA_TGS_REQ )
+            if ( preAuthData[ii].getPaDataType() == PaDataType.PA_TGS_REQ )
             {
-                undecodedAuthHeader = preAuthData[ii].getDataValue();
+                undecodedAuthHeader = preAuthData[ii].getPaDataValue();
             }
         }
 

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractAuthenticationServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractAuthenticationServiceTest.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractAuthenticationServiceTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractAuthenticationServiceTest.java Tue Oct 23 12:22:08 2007
@@ -37,10 +37,9 @@
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataModifier;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataType;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.server.kerberos.shared.messages.value.PrincipalName;
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.directory.server.kerberos.shared.messages.value.types.PrincipalNameType;
 import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoHandler;
@@ -65,7 +64,7 @@
     protected static final SecureRandom random = new SecureRandom();
 
 
-    protected PreAuthenticationData[] getPreAuthEncryptedTimeStamp( KerberosPrincipal clientPrincipal, String passPhrase )
+    protected PaData[] getPreAuthEncryptedTimeStamp( KerberosPrincipal clientPrincipal, String passPhrase )
         throws Exception
     {
         KerberosTime timeStamp = new KerberosTime();
@@ -74,10 +73,10 @@
     }
 
 
-    protected PreAuthenticationData[] getPreAuthEncryptedTimeStamp( KerberosPrincipal clientPrincipal,
+    protected PaData[] getPreAuthEncryptedTimeStamp( KerberosPrincipal clientPrincipal,
         String passPhrase, KerberosTime timeStamp ) throws Exception
     {
-        PreAuthenticationData[] paData = new PreAuthenticationData[1];
+        PaData[] paData = new PaData[1];
 
         EncryptedTimeStamp encryptedTimeStamp = new EncryptedTimeStamp( timeStamp, 0 );
 
@@ -87,11 +86,11 @@
 
         byte[] encodedEncryptedData = EncryptedDataEncoder.encode( encryptedData );
 
-        PreAuthenticationDataModifier preAuth = new PreAuthenticationDataModifier();
-        preAuth.setDataType( PreAuthenticationDataType.PA_ENC_TIMESTAMP );
-        preAuth.setDataValue( encodedEncryptedData );
+        PaData preAuth = new PaData();
+        preAuth.setPaDataType( PaDataType.PA_ENC_TIMESTAMP );
+        preAuth.setPaDataValue( encodedEncryptedData );
 
-        paData[0] = preAuth.getPreAuthenticationData();
+        paData[0] = preAuth;
 
         return paData;
     }

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AbstractTicketGrantingServiceTest.java Tue Oct 23 12:22:08 2007
@@ -53,13 +53,12 @@
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataModifier;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataType;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.server.kerberos.shared.messages.value.PrincipalName;
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBody;
 import org.apache.directory.server.kerberos.shared.messages.value.TicketFlags;
 import org.apache.directory.server.kerberos.shared.messages.value.TransitedEncoding;
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.directory.server.kerberos.shared.messages.value.types.PrincipalNameType;
 import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoHandler;
@@ -235,7 +234,7 @@
 
         EncryptedData authenticator = getAuthenticator( tgt.getClientPrincipal(), requestBody, checksumType );
 
-        PreAuthenticationData[] paData = getPreAuthenticationData( tgt, authenticator );
+        PaData[] paData = getPreAuthenticationData( tgt, authenticator );
 
         return new KdcRequest( 5, MessageType.KRB_TGS_REQ, paData, requestBody );
     }
@@ -295,7 +294,7 @@
      * @return
      * @throws IOException
      */
-    protected PreAuthenticationData[] getPreAuthenticationData( Ticket ticket, EncryptedData authenticator )
+    protected PaData[] getPreAuthenticationData( Ticket ticket, EncryptedData authenticator )
         throws IOException
     {
         ApplicationRequest applicationRequest = new ApplicationRequest();
@@ -308,14 +307,13 @@
         ApplicationRequestEncoder encoder = new ApplicationRequestEncoder();
         byte[] encodedApReq = encoder.encode( applicationRequest );
 
-        PreAuthenticationData[] paData = new PreAuthenticationData[1];
+        PaData[] paData = new PaData[1];
 
-        PreAuthenticationDataModifier preAuth = new PreAuthenticationDataModifier();
-        preAuth.setDataType( PreAuthenticationDataType.PA_TGS_REQ );
+        PaData preAuth = new PaData();
+        preAuth.setPaDataType( PaDataType.PA_TGS_REQ );
+        preAuth.setPaDataValue( encodedApReq );
 
-        preAuth.setDataValue( encodedApReq );
-
-        paData[0] = preAuth.getPreAuthenticationData();
+        paData[0] = preAuth;
 
         return paData;
     }

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java Tue Oct 23 12:22:08 2007
@@ -41,11 +41,10 @@
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.messages.value.KdcOptions;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataModifier;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataType;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBodyModifier;
 import org.apache.directory.server.kerberos.shared.messages.value.TicketFlags;
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 
 
@@ -101,7 +100,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -150,7 +149,7 @@
         EncryptionKey clientKey = keyMap.get( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
 
         KerberosTime timeStamp = new KerberosTime();
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientKey, timeStamp );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientKey, timeStamp );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -202,7 +201,7 @@
         EncryptionKey clientKey = keyMap.get( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
 
         KerberosTime timeStamp = new KerberosTime();
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientKey, timeStamp );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientKey, timeStamp );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -244,7 +243,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -255,10 +254,10 @@
     }
 
 
-    protected PreAuthenticationData[] getPreAuthEncryptedTimeStamp( EncryptionKey clientKey, KerberosTime timeStamp )
+    protected PaData[] getPreAuthEncryptedTimeStamp( EncryptionKey clientKey, KerberosTime timeStamp )
         throws Exception
     {
-        PreAuthenticationData[] paData = new PreAuthenticationData[1];
+        PaData[] paData = new PaData[1];
 
         EncryptedTimeStamp encryptedTimeStamp = new EncryptedTimeStamp( timeStamp, 0 );
 
@@ -266,11 +265,11 @@
 
         byte[] encodedEncryptedData = EncryptedDataEncoder.encode( encryptedData );
 
-        PreAuthenticationDataModifier preAuth = new PreAuthenticationDataModifier();
-        preAuth.setDataType( PreAuthenticationDataType.PA_ENC_TIMESTAMP );
-        preAuth.setDataValue( encodedEncryptedData );
+        PaData preAuth = new PaData();
+        preAuth.setPaDataType( PaDataType.PA_ENC_TIMESTAMP );
+        preAuth.setPaDataValue( encodedEncryptedData );
 
-        paData[0] = preAuth.getPreAuthenticationData();
+        paData[0] = preAuth;
 
         return paData;
     }

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java Tue Oct 23 12:22:08 2007
@@ -31,7 +31,7 @@
 import org.apache.directory.server.kerberos.shared.messages.MessageType;
 import org.apache.directory.server.kerberos.shared.messages.value.KdcOptions;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBodyModifier;
 import org.apache.directory.server.kerberos.shared.messages.value.TicketFlags;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
@@ -188,7 +188,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -215,7 +215,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -264,7 +264,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -305,7 +305,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -353,7 +353,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -401,7 +401,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -448,7 +448,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -490,7 +490,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -531,7 +531,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -584,7 +584,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -634,7 +634,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -677,7 +677,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -715,7 +715,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -754,7 +754,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -806,7 +806,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -855,7 +855,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -899,7 +899,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -943,7 +943,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -993,7 +993,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -1046,7 +1046,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -1091,7 +1091,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -1127,7 +1127,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -1163,7 +1163,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -1199,7 +1199,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -1235,7 +1235,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java?rev=587624&r1=587623&r2=587624&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java Tue Oct 23 12:22:08 2007
@@ -34,10 +34,9 @@
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.messages.value.KdcOptions;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataModifier;
-import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataType;
+import org.apache.directory.server.kerberos.shared.messages.value.PaData;
 import org.apache.directory.server.kerberos.shared.messages.value.RequestBodyModifier;
+import org.apache.directory.server.kerberos.shared.messages.value.types.PaDataType;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 
 
@@ -125,7 +124,7 @@
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
 
         String passPhrase = "badpassword";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -162,7 +161,7 @@
 
         KerberosTime timeStamp = new KerberosTime( 0 );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase, timeStamp );
+        PaData[] paData = getPreAuthEncryptedTimeStamp( clientPrincipal, passPhrase, timeStamp );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -197,7 +196,7 @@
 
         KerberosPrincipal clientPrincipal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
         String passPhrase = "secret";
-        PreAuthenticationData[] paData = getPreAuthPublicKey( clientPrincipal, passPhrase );
+        PaData[] paData = getPreAuthPublicKey( clientPrincipal, passPhrase );
 
         KdcRequest message = new KdcRequest( 5, MessageType.KRB_AS_REQ, paData, modifier.getRequestBody() );
 
@@ -220,7 +219,7 @@
      * @return The array of pre-authentication data.
      * @throws Exception
      */
-    private PreAuthenticationData[] getPreAuthPublicKey( KerberosPrincipal clientPrincipal, String passPhrase )
+    private PaData[] getPreAuthPublicKey( KerberosPrincipal clientPrincipal, String passPhrase )
         throws Exception
     {
         KerberosTime timeStamp = new KerberosTime();
@@ -241,10 +240,10 @@
      * @return The array of pre-authentication data.
      * @throws Exception
      */
-    private PreAuthenticationData[] getPreAuthPublicKey( KerberosPrincipal clientPrincipal, String passPhrase,
+    private PaData[] getPreAuthPublicKey( KerberosPrincipal clientPrincipal, String passPhrase,
         KerberosTime timeStamp ) throws Exception
     {
-        PreAuthenticationData[] paData = new PreAuthenticationData[1];
+        PaData[] paData = new PaData[1];
 
         EncryptedTimeStamp encryptedTimeStamp = new EncryptedTimeStamp( timeStamp, 0 );
 
@@ -254,11 +253,11 @@
 
         byte[] encodedEncryptedData = EncryptedDataEncoder.encode( encryptedData );
 
-        PreAuthenticationDataModifier preAuth = new PreAuthenticationDataModifier();
-        preAuth.setDataType( PreAuthenticationDataType.PA_PK_AS_REQ );
-        preAuth.setDataValue( encodedEncryptedData );
+        PaData preAuth = new PaData();
+        preAuth.setPaDataType( PaDataType.PA_PK_AS_REQ );
+        preAuth.setPaDataValue( encodedEncryptedData );
 
-        paData[0] = preAuth.getPreAuthenticationData();
+        paData[0] = preAuth;
 
         return paData;
     }



Mime
View raw message