directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r578743 [2/12] - in /directory/apacheds/branches/apacheds-kerberos: kerberos-shared/ kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/ kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto...
Date Mon, 24 Sep 2007 10:18:45 GMT
Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactory.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactory.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactory.java Mon Sep 24 03:18:05 2007
@@ -30,9 +30,9 @@
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
 
-import org.apache.directory.server.kerberos.shared.exceptions.ErrorType;
 import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
+import org.apache.directory.server.kerberos.shared.messages.value.types.KerberosErrorType;
 
 
 /**
@@ -111,7 +111,7 @@
 
         if ( algorithm == null )
         {
-            throw new KerberosException( ErrorType.KDC_ERR_ETYPE_NOSUPP, encryptionType.getName()
+            throw new KerberosException( KerberosErrorType.KDC_ERR_ETYPE_NOSUPP, encryptionType.getName()
                 + " is not a supported encryption type." );
         }
 
@@ -137,7 +137,7 @@
         }
         catch ( NoSuchAlgorithmException nsae )
         {
-            throw new KerberosException( ErrorType.KDC_ERR_ETYPE_NOSUPP, nsae );
+            throw new KerberosException( KerberosErrorType.KDC_ERR_ETYPE_NOSUPP, nsae );
         }
     }
 }

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/exceptions/KerberosException.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/exceptions/KerberosException.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/exceptions/KerberosException.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/exceptions/KerberosException.java Mon Sep 24 03:18:05 2007
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.server.kerberos.shared.exceptions;
 
+import org.apache.directory.server.kerberos.shared.messages.value.types.KerberosErrorType;
+
 
 /**
  * The root of the Kerberos exception hierarchy.
@@ -43,40 +45,40 @@
 
 
     /**
-     * Creates a KerberosException with an {@link ErrorType}.
+     * Creates a KerberosException with an {@link KerberosErrorType}.
      *
      * @param errorType The error type associated with this KerberosException.
      */
-    public KerberosException( ErrorType errorType )
+    public KerberosException( KerberosErrorType errorType )
     {
-        super( errorType.getMessage() );
+        super( errorType.toString() );
 
         this.errorCode = errorType.getOrdinal();
     }
 
 
     /**
-     * Creates a KerberosException with an {@link ErrorType} and an
+     * Creates a KerberosException with an {@link KerberosErrorType} and an
      * underlying {@link Throwable} that caused this fault.
      *
      * @param errorType The error type associated with this KerberosException.
      * @param cause The underlying failure, if any.
      */
-    public KerberosException( ErrorType errorType, Throwable cause )
+    public KerberosException( KerberosErrorType errorType, Throwable cause )
     {
-        super( errorType.getMessage(), cause );
+        super( errorType.toString(), cause );
 
         this.errorCode = errorType.getOrdinal();
     }
 
 
     /**
-     * Creates a KerberosException with an {@link ErrorType} and a custom error message.
+     * Creates a KerberosException with an {@link KerberosErrorType} and a custom error message.
      *
-     * @param errorType The {@link ErrorType} associated with this KerberosException.
+     * @param errorType The {@link KerberosErrorType} associated with this KerberosException.
      * @param msg A custom error message for this KerberosException.
      */
-    public KerberosException( ErrorType errorType, String msg )
+    public KerberosException( KerberosErrorType errorType, String msg )
     {
         super( msg );
 
@@ -85,14 +87,14 @@
 
 
     /**
-     * Creates a KerberosException with an {@link ErrorType}, a custom error message, and an
+     * Creates a KerberosException with an {@link KerberosErrorType}, a custom error message, and an
      * underlying {@link Throwable} that caused this fault.
      *
      * @param errorType The error type associated with this KerberosException.
      * @param msg A custom error message for this KerberosException.
      * @param cause The underlying failure, if any.
      */
-    public KerberosException( ErrorType errorType, String msg, Throwable cause )
+    public KerberosException( KerberosErrorType errorType, String msg, Throwable cause )
     {
         super( msg, cause );
 
@@ -101,15 +103,15 @@
 
 
     /**
-     * Creates a KerberosException with an {@link ErrorType} and data helping to
+     * Creates a KerberosException with an {@link KerberosErrorType} and data helping to
      * explain what caused this fault.
      *
      * @param errorType The error type associated with this KerberosException.
      * @param explanatoryData Data helping to explain this fault, if any.
      */
-    public KerberosException( ErrorType errorType, byte[] explanatoryData )
+    public KerberosException( KerberosErrorType errorType, byte[] explanatoryData )
     {
-        super( errorType.getMessage() );
+        super( errorType.toString() );
 
         this.errorCode = errorType.getOrdinal();
         this.explanatoryData = explanatoryData;
@@ -117,16 +119,16 @@
 
 
     /**
-     * Creates a KerberosException with an {@link ErrorType}, data helping to
+     * Creates a KerberosException with an {@link KerberosErrorType}, data helping to
      * explain what caused this fault, and an underlying {@link Throwable} that caused this fault.
      *
      * @param errorType The error type associated with this KerberosException.
      * @param explanatoryData Data helping to explain this fault, if any.
      * @param cause The underlying failure, if any.
      */
-    public KerberosException( ErrorType errorType, byte[] explanatoryData, Throwable cause )
+    public KerberosException( KerberosErrorType errorType, byte[] explanatoryData, Throwable cause )
     {
-        super( errorType.getMessage(), cause );
+        super( errorType.toString(), cause );
 
         this.errorCode = errorType.getOrdinal();
         this.explanatoryData = explanatoryData;

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ApplicationRequestDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ApplicationRequestDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ApplicationRequestDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ApplicationRequestDecoder.java Mon Sep 24 03:18:05 2007
@@ -23,9 +23,9 @@
 import java.io.IOException;
 import java.util.Enumeration;
 
-import org.apache.directory.server.kerberos.shared.messages.ApplicationRequest;
 import org.apache.directory.server.kerberos.shared.messages.MessageType;
-import org.apache.directory.server.kerberos.shared.messages.value.ApOptions;
+import org.apache.directory.server.kerberos.shared.messages.application.ApplicationRequest;
+import org.apache.directory.server.kerberos.shared.messages.value.flags.ApOptions;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DERBitString;

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthenticatorDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthenticatorDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthenticatorDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthenticatorDecoder.java Mon Sep 24 03:18:05 2007
@@ -25,7 +25,6 @@
 
 import org.apache.directory.server.kerberos.shared.messages.Encodable;
 import org.apache.directory.server.kerberos.shared.messages.components.Authenticator;
-import org.apache.directory.server.kerberos.shared.messages.components.AuthenticatorModifier;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DEREncodable;
@@ -78,7 +77,7 @@
      */
     protected static Authenticator decode( DERSequence sequence )
     {
-        AuthenticatorModifier modifier = new AuthenticatorModifier();
+        Authenticator authenticator = new Authenticator();
 
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
@@ -90,43 +89,51 @@
             {
                 case 0:
                     DERInteger tag0 = ( DERInteger ) derObject;
-                    modifier.setVersionNumber( tag0.intValue() );
+                    authenticator.setVersionNumber( tag0.intValue() );
                     break;
+                    
                 case 1:
                     DERGeneralString tag1 = ( DERGeneralString ) derObject;
-                    modifier.setClientRealm( tag1.getString() );
+                    authenticator.setClientRealm( tag1.getString() );
                     break;
+                    
                 case 2:
                     DERSequence tag2 = ( DERSequence ) derObject;
-                    modifier.setClientName( PrincipalNameDecoder.decode( tag2 ) );
+                    authenticator.setClientPrincipalName( PrincipalNameDecoder.decode( tag2 ) );
                     break;
+                    
                 case 3:
                     DERSequence tag3 = ( DERSequence ) derObject;
-                    modifier.setChecksum( ChecksumDecoder.decode( tag3 ) );
+                    authenticator.setChecksum( ChecksumDecoder.decode( tag3 ) );
                     break;
+                    
                 case 4:
                     DERInteger tag4 = ( DERInteger ) derObject;
-                    modifier.setClientMicroSecond( tag4.intValue() );
+                    authenticator.setClientMicroSecond( tag4.intValue() );
                     break;
+                    
                 case 5:
                     DERGeneralizedTime tag5 = ( DERGeneralizedTime ) derObject;
-                    modifier.setClientTime( KerberosTimeDecoder.decode( tag5 ) );
+                    authenticator.setClientTime( KerberosTimeDecoder.decode( tag5 ) );
                     break;
+                    
                 case 6:
                     DERSequence tag6 = ( DERSequence ) derObject;
-                    modifier.setSubSessionKey( EncryptionKeyDecoder.decode( tag6 ) );
+                    authenticator.setSubSessionKey( EncryptionKeyDecoder.decode( tag6 ) );
                     break;
+                    
                 case 7:
                     DERInteger tag7 = ( DERInteger ) derObject;
-                    modifier.setSequenceNumber( tag7.intValue() );
+                    authenticator.setSequenceNumber( tag7.intValue() );
                     break;
+                    
                 case 8:
                     DERSequence tag8 = ( DERSequence ) derObject;
-                    modifier.setAuthorizationData( AuthorizationDataDecoder.decodeSequence( tag8 ) );
+                    authenticator.setAuthorizationData( AuthorizationDataDecoder.decodeSequence( tag8 ) );
                     break;
             }
         }
 
-        return modifier.getAuthenticator();
+        return authenticator;
     }
 }

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthorizationDataDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthorizationDataDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthorizationDataDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/AuthorizationDataDecoder.java Mon Sep 24 03:18:05 2007
@@ -26,7 +26,7 @@
 import org.apache.directory.server.kerberos.shared.messages.Encodable;
 import org.apache.directory.server.kerberos.shared.messages.value.AuthorizationData;
 import org.apache.directory.server.kerberos.shared.messages.value.AuthorizationDataEntry;
-import org.apache.directory.server.kerberos.shared.messages.value.AuthorizationType;
+import org.apache.directory.server.kerberos.shared.messages.value.types.AuthorizationType;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DEREncodable;
 import org.apache.directory.shared.asn1.der.DERInteger;

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncKdcRepPartDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncKdcRepPartDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncKdcRepPartDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncKdcRepPartDecoder.java Mon Sep 24 03:18:05 2007
@@ -26,7 +26,7 @@
 import org.apache.directory.server.kerberos.shared.messages.Encodable;
 import org.apache.directory.server.kerberos.shared.messages.components.EncKdcRepPart;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosPrincipalModifier;
-import org.apache.directory.server.kerberos.shared.messages.value.TicketFlags;
+import org.apache.directory.server.kerberos.shared.messages.value.flags.TicketFlags;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DERBitString;

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncKrbPrivPartDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncKrbPrivPartDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncKrbPrivPartDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncKrbPrivPartDecoder.java Mon Sep 24 03:18:05 2007
@@ -25,7 +25,6 @@
 
 import org.apache.directory.server.kerberos.shared.messages.Encodable;
 import org.apache.directory.server.kerberos.shared.messages.components.EncKrbPrivPart;
-import org.apache.directory.server.kerberos.shared.messages.components.EncKrbPrivPartModifier;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DEREncodable;
@@ -62,7 +61,7 @@
 
     private EncKrbPrivPart decodePrivatePartSequence( DERSequence sequence )
     {
-        EncKrbPrivPartModifier modifier = new EncKrbPrivPartModifier();
+        EncKrbPrivPart encKrbPrivPart = new EncKrbPrivPart();
 
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
@@ -74,30 +73,36 @@
             {
                 case 0:
                     DEROctetString tag0 = ( DEROctetString ) derObject;
-                    modifier.setUserData( tag0.getOctets() );
+                    encKrbPrivPart.setUserData( tag0.getOctets() );
                     break;
+                    
                 case 1:
                     DERGeneralizedTime tag1 = ( DERGeneralizedTime ) derObject;
-                    modifier.setTimestamp( KerberosTimeDecoder.decode( tag1 ) );
+                    encKrbPrivPart.setTimestamp( KerberosTimeDecoder.decode( tag1 ) );
                     break;
+                    
                 case 2:
                     DERInteger tag2 = ( DERInteger ) derObject;
-                    modifier.setMicroSecond( new Integer( tag2.intValue() ) );
+                    encKrbPrivPart.setMicroSecond( new Integer( tag2.intValue() ) );
                     break;
+                    
                 case 3:
                     DERInteger tag3 = ( DERInteger ) derObject;
-                    modifier.setSequenceNumber( new Integer( tag3.intValue() ) );
+                    encKrbPrivPart.setSequenceNumber( new Integer( tag3.intValue() ) );
                     break;
+                    
                 case 4:
                     DERSequence tag4 = ( DERSequence ) derObject;
-                    modifier.setSenderAddress( HostAddressDecoder.decode( tag4 ) );
+                    encKrbPrivPart.setSenderAddress( HostAddressDecoder.decode( tag4 ) );
                     break;
+                    
                 case 5:
                     DERSequence tag5 = ( DERSequence ) derObject;
-                    modifier.setRecipientAddress( HostAddressDecoder.decode( tag5 ) );
+                    encKrbPrivPart.setRecipientAddress( HostAddressDecoder.decode( tag5 ) );
                     break;
             }
         }
-        return modifier.getEncKrbPrivPart();
+        
+        return encKrbPrivPart;
     }
 }

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncTicketPartDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncTicketPartDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncTicketPartDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncTicketPartDecoder.java Mon Sep 24 03:18:05 2007
@@ -21,14 +21,14 @@
 
 
 import java.io.IOException;
+import java.text.ParseException;
 import java.util.Enumeration;
 
 import org.apache.directory.server.kerberos.shared.messages.Encodable;
 import org.apache.directory.server.kerberos.shared.messages.components.EncTicketPart;
-import org.apache.directory.server.kerberos.shared.messages.components.EncTicketPartModifier;
-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.TransitedEncodingType;
+import org.apache.directory.server.kerberos.shared.messages.value.flags.TicketFlags;
+import org.apache.directory.server.kerberos.shared.messages.value.types.TransitedEncodingType;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DERBitString;
@@ -82,7 +82,7 @@
      }*/
     private EncTicketPart decodeEncTicketPartSequence( DERSequence sequence )
     {
-        EncTicketPartModifier modifier = new EncTicketPartModifier();
+        EncTicketPart ticketPart = new EncTicketPart();
 
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
@@ -94,51 +94,71 @@
             {
                 case 0:
                     DERBitString tag0 = ( DERBitString ) derObject;
-                    modifier.setFlags( new TicketFlags( tag0.getOctets() ) );
+                    ticketPart.setFlags( new TicketFlags( tag0.getOctets() ) );
                     break;
+                    
                 case 1:
                     DERSequence tag1 = ( DERSequence ) derObject;
-                    modifier.setSessionKey( EncryptionKeyDecoder.decode( tag1 ) );
+                    ticketPart.setSessionKey( EncryptionKeyDecoder.decode( tag1 ) );
                     break;
+                    
                 case 2:
                     DERGeneralString tag2 = ( DERGeneralString ) derObject;
-                    modifier.setClientRealm( tag2.getString() );
+                    ticketPart.setClientRealm( tag2.getString() );
                     break;
+                    
                 case 3:
                     DERSequence tag3 = ( DERSequence ) derObject;
-                    modifier.setClientName( PrincipalNameDecoder.decode( tag3 ) );
+                    
+                    try
+                    {
+                        ticketPart.setClientPrincipalName( PrincipalNameDecoder.decode( tag3 ) );
+                    }
+                    catch ( ParseException pe )
+                    {
+                        // Do nothing
+                    }
+                    
                     break;
+                    
                 case 4:
                     DERSequence tag4 = ( DERSequence ) derObject;
-                    modifier.setTransitedEncoding( decodeTransitedEncoding( tag4 ) );
+                    ticketPart.setTransitedEncoding( decodeTransitedEncoding( tag4 ) );
                     break;
+                    
                 case 5:
                     DERGeneralizedTime tag5 = ( DERGeneralizedTime ) derObject;
-                    modifier.setAuthTime( KerberosTimeDecoder.decode( tag5 ) );
+                    ticketPart.setAuthTime( KerberosTimeDecoder.decode( tag5 ) );
                     break;
+                    
                 case 6:
                     DERGeneralizedTime tag6 = ( DERGeneralizedTime ) derObject;
-                    modifier.setStartTime( KerberosTimeDecoder.decode( tag6 ) );
+                    ticketPart.setStartTime( KerberosTimeDecoder.decode( tag6 ) );
                     break;
+                    
                 case 7:
                     DERGeneralizedTime tag7 = ( DERGeneralizedTime ) derObject;
-                    modifier.setEndTime( KerberosTimeDecoder.decode( tag7 ) );
+                    ticketPart.setEndTime( KerberosTimeDecoder.decode( tag7 ) );
                     break;
+                    
                 case 8:
                     DERGeneralizedTime tag8 = ( DERGeneralizedTime ) derObject;
-                    modifier.setRenewTill( KerberosTimeDecoder.decode( tag8 ) );
+                    ticketPart.setRenewTill( KerberosTimeDecoder.decode( tag8 ) );
                     break;
+                    
                 case 9:
                     DERSequence tag9 = ( DERSequence ) derObject;
-                    modifier.setClientAddresses( HostAddressDecoder.decodeSequence( tag9 ) );
+                    ticketPart.setClientAddresses( HostAddressDecoder.decodeSequence( tag9 ) );
                     break;
+                    
                 case 10:
                     DERSequence tag10 = ( DERSequence ) derObject;
-                    modifier.setAuthorizationData( AuthorizationDataDecoder.decodeSequence( tag10 ) );
+                    ticketPart.setAuthorizationData( AuthorizationDataDecoder.decodeSequence( tag10 ) );
                     break;
             }
         }
-        return modifier.getEncTicketPart();
+        
+        return ticketPart;
     }
 
 

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedDataDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedDataDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedDataDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedDataDecoder.java Mon Sep 24 03:18:05 2007
@@ -25,7 +25,6 @@
 
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
-import org.apache.directory.server.kerberos.shared.messages.value.EncryptedDataModifier;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DEREncodable;
 import org.apache.directory.shared.asn1.der.DERInteger;
@@ -71,7 +70,7 @@
      */
     public static EncryptedData decode( DERSequence sequence )
     {
-        EncryptedDataModifier modifier = new EncryptedDataModifier();
+        EncryptedData encryptedData = new EncryptedData();
 
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
@@ -83,19 +82,21 @@
             {
                 case 0:
                     DERInteger etype = ( DERInteger ) derObject;
-                    modifier.setEncryptionType( EncryptionType.getTypeByOrdinal( etype.intValue() ) );
+                    encryptedData.setEncryptionType( EncryptionType.getTypeByOrdinal( etype.intValue() ) );
                     break;
+                    
                 case 1:
                     DERInteger kvno = ( DERInteger ) derObject;
-                    modifier.setKeyVersion( kvno.intValue() );
+                    encryptedData.setKeyVersion( kvno.intValue() );
                     break;
+                    
                 case 2:
                     DEROctetString cipher = ( DEROctetString ) derObject;
-                    modifier.setCipherText( cipher.getOctets() );
+                    encryptedData.setCipherText( cipher.getOctets() );
                     break;
             }
         }
 
-        return modifier.getEncryptedData();
+        return encryptedData;
     }
 }

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedTimestampDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedTimestampDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedTimestampDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptedTimestampDecoder.java Mon Sep 24 03:18:05 2007
@@ -24,7 +24,7 @@
 import java.util.Enumeration;
 
 import org.apache.directory.server.kerberos.shared.messages.Encodable;
-import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp;
+import org.apache.directory.server.kerberos.shared.messages.value.PreAuthEncryptedTimestamp;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStampModifier;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DEREncodable;
@@ -64,7 +64,7 @@
     }
 
 
-    protected EncryptedTimeStamp decodeEncryptedTimestamp( DERSequence sequence )
+    protected PreAuthEncryptedTimestamp decodeEncryptedTimestamp( DERSequence sequence )
     {
         EncryptedTimeStampModifier modifier = new EncryptedTimeStampModifier();
 

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptionTypeDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptionTypeDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptionTypeDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/EncryptionTypeDecoder.java Mon Sep 24 03:18:05 2007
@@ -20,7 +20,9 @@
 package org.apache.directory.server.kerberos.shared.io.decoder;
 
 
+import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.List;
 
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.shared.asn1.der.DERInteger;
@@ -37,16 +39,14 @@
      * etype[8]             SEQUENCE OF INTEGER, -- EncryptionType,
      *             -- in preference order
      */
-    protected static EncryptionType[] decode( DERSequence sequence )
+    protected static List<EncryptionType> decode( DERSequence sequence )
     {
-        EncryptionType[] eTypes = new EncryptionType[sequence.size()];
+        List<EncryptionType> eTypes = new ArrayList<EncryptionType>( sequence.size() );
 
-        int ii = 0;
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
             DERInteger object = ( DERInteger ) e.nextElement();
-            eTypes[ii] = EncryptionType.getTypeByOrdinal( object.intValue() );
-            ii++;
+            eTypes.add( EncryptionType.getTypeByOrdinal( object.intValue() ) );
         }
 
         return eTypes;

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ErrorMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ErrorMessageDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ErrorMessageDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/ErrorMessageDecoder.java Mon Sep 24 03:18:05 2007
@@ -24,9 +24,9 @@
 import java.nio.ByteBuffer;
 import java.util.Enumeration;
 
-import org.apache.directory.server.kerberos.shared.messages.ErrorMessage;
-import org.apache.directory.server.kerberos.shared.messages.ErrorMessageModifier;
+import org.apache.directory.server.kerberos.shared.messages.KerberosError;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosPrincipalModifier;
+import org.apache.directory.server.kerberos.shared.messages.value.types.KerberosErrorType;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DEREncodable;
@@ -45,15 +45,15 @@
 public class ErrorMessageDecoder
 {
     /**
-     * Decodes a {@link ByteBuffer} into an {@link ErrorMessage}.
+     * Decodes a {@link ByteBuffer} into an {@link KerberosError}.
      * 
      * KRB-ERROR       ::= [APPLICATION 30] SEQUENCE
      *
      * @param in
-     * @return The {@link ErrorMessage}.
+     * @return The {@link KerberosError}.
      * @throws IOException
      */
-    public ErrorMessage decode( ByteBuffer in ) throws IOException
+    public KerberosError decode( ByteBuffer in ) throws IOException
     {
         ASN1InputStream ais = new ASN1InputStream( in );
 
@@ -82,9 +82,9 @@
      e-data          [12] OCTET STRING OPTIONAL
      }
      */
-    private ErrorMessage decodeErrorMessageSequence( DERSequence sequence )
+    private KerberosError decodeErrorMessageSequence( DERSequence sequence )
     {
-        ErrorMessageModifier errorModifier = new ErrorMessageModifier();
+        KerberosError kerberosError = new KerberosError();
         KerberosPrincipalModifier clientModifier = new KerberosPrincipalModifier();
         KerberosPrincipalModifier serverModifier = new KerberosPrincipalModifier();
 
@@ -106,23 +106,23 @@
                     break;
                 case 2:
                     DERGeneralizedTime tag2 = ( DERGeneralizedTime ) derObject;
-                    errorModifier.setClientTime( KerberosTimeDecoder.decode( tag2 ) );
+                    kerberosError.setClientTime( KerberosTimeDecoder.decode( tag2 ) );
                     break;
                 case 3:
                     DERInteger tag3 = ( DERInteger ) derObject;
-                    errorModifier.setClientMicroSecond( tag3.intValue() );
+                    kerberosError.setClientMicroSecond( tag3.intValue() );
                     break;
                 case 4:
                     DERGeneralizedTime tag4 = ( DERGeneralizedTime ) derObject;
-                    errorModifier.setServerTime( KerberosTimeDecoder.decode( tag4 ) );
+                    kerberosError.setServerTime( KerberosTimeDecoder.decode( tag4 ) );
                     break;
                 case 5:
                     DERInteger tag5 = ( DERInteger ) derObject;
-                    errorModifier.setServerMicroSecond( tag5.intValue() );
+                    kerberosError.setServerMicroseconds( tag5.intValue() );
                     break;
                 case 6:
                     DERInteger tag6 = ( DERInteger ) derObject;
-                    errorModifier.setErrorCode( tag6.intValue() );
+                    kerberosError.setErrorCode( KerberosErrorType.getTypeByOrdinal( tag6.intValue() ) );
                     break;
                 case 7:
                     DERGeneralString tag7 = ( DERGeneralString ) derObject;
@@ -142,18 +142,18 @@
                     break;
                 case 11:
                     DERGeneralString tag11 = ( DERGeneralString ) derObject;
-                    errorModifier.setExplanatoryText( tag11.getString() );
+                    kerberosError.setExplanatoryText( tag11.getString() );
                     break;
                 case 12:
                     DEROctetString tag12 = ( DEROctetString ) derObject;
-                    errorModifier.setExplanatoryData( tag12.getOctets() );
+                    kerberosError.setExplanatoryData( tag12.getOctets() );
                     break;
             }
         }
 
-        errorModifier.setClientPrincipal( clientModifier.getKerberosPrincipal() );
-        errorModifier.setServerPrincipal( serverModifier.getKerberosPrincipal() );
+        kerberosError.setClientPrincipal( clientModifier.getKerberosPrincipal() );
+        kerberosError.setServerPrincipal( serverModifier.getKerberosPrincipal() );
 
-        return errorModifier.getErrorMessage();
+        return kerberosError;
     }
 }

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/HostAddressDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/HostAddressDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/HostAddressDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/HostAddressDecoder.java Mon Sep 24 03:18:05 2007
@@ -23,8 +23,8 @@
 import java.util.Enumeration;
 
 import org.apache.directory.server.kerberos.shared.messages.value.HostAddress;
-import org.apache.directory.server.kerberos.shared.messages.value.HostAddressType;
 import org.apache.directory.server.kerberos.shared.messages.value.HostAddresses;
+import org.apache.directory.server.kerberos.shared.messages.value.types.HostAddressType;
 import org.apache.directory.shared.asn1.der.DEREncodable;
 import org.apache.directory.shared.asn1.der.DERInteger;
 import org.apache.directory.shared.asn1.der.DEROctetString;
@@ -46,7 +46,7 @@
      */
     protected static HostAddress decode( DERSequence sequence )
     {
-        HostAddressType type = HostAddressType.ADDRTYPE_IPV4;
+        HostAddressType type = HostAddressType.ADDRTYPE_INET;
         byte[] value = null;
 
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcReplyDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcReplyDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcReplyDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcReplyDecoder.java Mon Sep 24 03:18:05 2007
@@ -23,6 +23,7 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.Enumeration;
+import java.util.List;
 
 import javax.security.auth.kerberos.KerberosPrincipal;
 
@@ -82,7 +83,7 @@
     private KdcReply decodeKdcReplySequence( DERSequence sequence ) throws IOException
     {
         MessageType msgType = MessageType.NULL;
-        PreAuthenticationData[] paData = null;
+        List<PreAuthenticationData> paData = null;
         Ticket ticket = null;
         EncryptedData encPart = null;
 

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcRequestDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcRequestDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcRequestDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/KdcRequestDecoder.java Mon Sep 24 03:18:05 2007
@@ -23,13 +23,13 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.Enumeration;
+import java.util.List;
 
 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.RequestBody;
-import org.apache.directory.server.kerberos.shared.messages.value.RequestBodyModifier;
+import org.apache.directory.server.kerberos.shared.messages.value.KerberosRequestBody;
+import org.apache.directory.server.kerberos.shared.messages.value.flags.KdcOptions;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DERBitString;
@@ -81,8 +81,8 @@
         int pvno = 5;
         MessageType msgType = MessageType.NULL;
 
-        PreAuthenticationData[] paData = null;
-        RequestBody requestBody = null;
+        List<PreAuthenticationData> paData = null;
+        KerberosRequestBody requestBody = null;
         byte[] bodyBytes = null;
 
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
@@ -143,9 +143,9 @@
      -- Encrypted AuthorizationData encoding
      additional-tickets[11]       SEQUENCE OF Ticket OPTIONAL
      }*/
-    private RequestBody decodeRequestBody( DERSequence sequence ) throws IOException
+    private KerberosRequestBody decodeRequestBody( DERSequence sequence ) throws IOException
     {
-        RequestBodyModifier modifier = new RequestBodyModifier();
+        KerberosRequestBody requestBody = new KerberosRequestBody();
 
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
@@ -157,55 +157,58 @@
             {
                 case 0:
                     DERBitString kdcOptions = ( DERBitString ) derObject;
-                    modifier.setKdcOptions( new KdcOptions( kdcOptions.getOctets() ) );
+                    KdcOptions options = new KdcOptions();
+                    options.setData( kdcOptions.getOctets() );
+                    requestBody.setKdcOptions( options );
                     break;
+                    
                 case 1:
                     DERSequence cName = ( DERSequence ) derObject;
-                    modifier.setClientName( PrincipalNameDecoder.decode( cName ) );
+                    requestBody.setClientPrincipalName( PrincipalNameDecoder.decode( cName ) );
                     break;
                 case 2:
                     DERGeneralString realm = ( DERGeneralString ) derObject;
-                    modifier.setRealm( realm.getString() );
+                    requestBody.setRealm( realm.getString() );
                     break;
                 case 3:
                     DERSequence sname = ( DERSequence ) derObject;
-                    modifier.setServerName( PrincipalNameDecoder.decode( sname ) );
+                    requestBody.setServerPrincipalName( PrincipalNameDecoder.decode( sname ) );
                     break;
                 case 4:
                     DERGeneralizedTime from = ( DERGeneralizedTime ) derObject;
-                    modifier.setFrom( KerberosTimeDecoder.decode( from ) );
+                    requestBody.setFrom( KerberosTimeDecoder.decode( from ) );
                     break;
                 case 5:
                     DERGeneralizedTime till = ( DERGeneralizedTime ) derObject;
-                    modifier.setTill( KerberosTimeDecoder.decode( till ) );
+                    requestBody.setTill( KerberosTimeDecoder.decode( till ) );
                     break;
                 case 6:
                     DERGeneralizedTime rtime = ( DERGeneralizedTime ) derObject;
-                    modifier.setRtime( KerberosTimeDecoder.decode( rtime ) );
+                    requestBody.setRenewtime( KerberosTimeDecoder.decode( rtime ) );
                     break;
                 case 7:
                     DERInteger nonce = ( DERInteger ) derObject;
-                    modifier.setNonce( nonce.intValue() );
+                    requestBody.setNonce( nonce.intValue() );
                     break;
                 case 8:
                     DERSequence etype = ( DERSequence ) derObject;
-                    modifier.setEType( EncryptionTypeDecoder.decode( etype ) );
+                    requestBody.setEncryptionType( EncryptionTypeDecoder.decode( etype ) );
                     break;
                 case 9:
                     DERSequence hostAddresses = ( DERSequence ) derObject;
-                    modifier.setAddresses( HostAddressDecoder.decodeSequence( hostAddresses ) );
+                    requestBody.setAddresses( HostAddressDecoder.decodeSequence( hostAddresses ) );
                     break;
                 case 10:
                     DERSequence encryptedData = ( DERSequence ) derObject;
-                    modifier.setEncAuthorizationData( EncryptedDataDecoder.decode( encryptedData ) );
+                    requestBody.setEncAuthorizationData( EncryptedDataDecoder.decode( encryptedData ) );
                     break;
                 case 11:
                     DERSequence tag11 = ( DERSequence ) derObject;
-                    modifier.setAdditionalTickets( TicketDecoder.decodeSequence( tag11 ) );
+                    requestBody.setAdditionalTickets( TicketDecoder.decodeSequence( tag11 ) );
                     break;
             }
         }
 
-        return modifier.getRequestBody();
+        return requestBody;
     }
 }

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/LastRequestDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/LastRequestDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/LastRequestDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/LastRequestDecoder.java Mon Sep 24 03:18:05 2007
@@ -25,7 +25,7 @@
 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.LastRequestEntry;
-import org.apache.directory.server.kerberos.shared.messages.value.LastRequestType;
+import org.apache.directory.server.kerberos.shared.messages.value.types.LastRequestType;
 import org.apache.directory.shared.asn1.der.DEREncodable;
 import org.apache.directory.shared.asn1.der.DERGeneralizedTime;
 import org.apache.directory.shared.asn1.der.DERInteger;

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PreAuthenticationDataDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PreAuthenticationDataDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PreAuthenticationDataDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PreAuthenticationDataDecoder.java Mon Sep 24 03:18:05 2007
@@ -21,11 +21,12 @@
 
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.List;
 
 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.types.PreAuthenticationDataType;
 import org.apache.directory.shared.asn1.der.ASN1InputStream;
 import org.apache.directory.shared.asn1.der.DEREncodable;
 import org.apache.directory.shared.asn1.der.DERInteger;
@@ -65,17 +66,15 @@
      *            req-body[4]           KDC-REQ-BODY
      * }
      */
-    protected static PreAuthenticationData[] decodeSequence( DERSequence sequence )
+    protected static List<PreAuthenticationData> decodeSequence( DERSequence sequence )
     {
-        PreAuthenticationData[] paDataSequence = new PreAuthenticationData[sequence.size()];
+        List<PreAuthenticationData> paDataSequence = new ArrayList<PreAuthenticationData>( sequence.size() );
 
-        int ii = 0;
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
             DERSequence object = ( DERSequence ) e.nextElement();
             PreAuthenticationData paData = PreAuthenticationDataDecoder.decode( object );
-            paDataSequence[ii] = paData;
-            ii++;
+            paDataSequence.add( paData );
         }
 
         return paDataSequence;
@@ -91,7 +90,8 @@
      */
     protected static PreAuthenticationData decode( DERSequence sequence )
     {
-        PreAuthenticationDataModifier modifier = new PreAuthenticationDataModifier();
+        PreAuthenticationDataType type = null; 
+        byte[] value = null;
 
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
@@ -103,16 +103,16 @@
             {
                 case 1:
                     DERInteger padataType = ( DERInteger ) derObject;
-                    PreAuthenticationDataType type = PreAuthenticationDataType.getTypeByOrdinal( padataType.intValue() );
-                    modifier.setDataType( type );
+                    type = PreAuthenticationDataType.getTypeByOrdinal( padataType.intValue() );
                     break;
+                    
                 case 2:
                     DEROctetString padataValue = ( DEROctetString ) derObject;
-                    modifier.setDataValue( padataValue.getOctets() );
+                    value = padataValue.getOctets();
                     break;
             }
         }
 
-        return modifier.getPreAuthenticationData();
+        return new PreAuthenticationData( type, value );
     }
 }

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PrincipalNameDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PrincipalNameDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PrincipalNameDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/PrincipalNameDecoder.java Mon Sep 24 03:18:05 2007
@@ -23,7 +23,7 @@
 import java.util.Enumeration;
 
 import org.apache.directory.server.kerberos.shared.messages.value.PrincipalName;
-import org.apache.directory.server.kerberos.shared.messages.value.PrincipalNameModifier;
+import org.apache.directory.server.kerberos.shared.messages.value.types.PrincipalNameType;
 import org.apache.directory.shared.asn1.der.DEREncodable;
 import org.apache.directory.shared.asn1.der.DERGeneralString;
 import org.apache.directory.shared.asn1.der.DERInteger;
@@ -50,7 +50,7 @@
      */
     public static PrincipalName decode( DERSequence sequence )
     {
-        PrincipalNameModifier modifier = new PrincipalNameModifier();
+        PrincipalName principalName = new PrincipalName();
 
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
@@ -62,25 +62,25 @@
             {
                 case 0:
                     DERInteger nameType = ( DERInteger ) derObject;
-                    modifier.setType( nameType.intValue() );
+                    principalName.setNameType( PrincipalNameType.getTypeByOrdinal( nameType.intValue() ) );
                     break;
                 case 1:
                     DERSequence nameString = ( DERSequence ) derObject;
-                    decodeNameString( nameString, modifier );
+                    decodeNameString( nameString, principalName );
                     break;
             }
         }
 
-        return modifier.getPrincipalName();
+        return principalName;
     }
 
 
-    private static void decodeNameString( DERSequence sequence, PrincipalNameModifier modifier )
+    private static void decodeNameString( DERSequence sequence, PrincipalName principalName )
     {
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
             DERGeneralString object = ( DERGeneralString ) e.nextElement();
-            modifier.addName( object.getString() );
+            principalName.addNameString( object.getString() );
         }
     }
 }

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/TicketDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/TicketDecoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/TicketDecoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/TicketDecoder.java Mon Sep 24 03:18:05 2007
@@ -21,7 +21,9 @@
 
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.List;
 
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
 import org.apache.directory.server.kerberos.shared.messages.components.TicketModifier;
@@ -64,15 +66,14 @@
      * @return The array of {@link Ticket}s.
      * @throws IOException
      */
-    public static Ticket[] decodeSequence( DERSequence sequence ) throws IOException
+    public static List<Ticket> decodeSequence( DERSequence sequence ) throws IOException
     {
-        Ticket[] tickets = new Ticket[sequence.size()];
+        List<Ticket> tickets = new ArrayList<Ticket>( sequence.size() );
 
-        int ii = 0;
         for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
         {
             DERApplicationSpecific object = ( DERApplicationSpecific ) e.nextElement();
-            tickets[ii] = decode( object );
+            tickets.add( decode( object ) );
         }
 
         return tickets;

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/ApplicationRequestEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/ApplicationRequestEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/ApplicationRequestEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/ApplicationRequestEncoder.java Mon Sep 24 03:18:05 2007
@@ -23,7 +23,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
-import org.apache.directory.server.kerberos.shared.messages.ApplicationRequest;
+import org.apache.directory.server.kerberos.shared.messages.application.ApplicationRequest;
 import org.apache.directory.shared.asn1.der.ASN1OutputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DERBitString;

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/AuthenticatorEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/AuthenticatorEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/AuthenticatorEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/AuthenticatorEncoder.java Mon Sep 24 03:18:05 2007
@@ -94,13 +94,13 @@
      */
     private DERSequence encodeInitialSequence( Authenticator authenticator )
     {
-        String clientRealm = authenticator.getClientPrincipal().getRealm();
+        String clientRealm = authenticator.getClientRealm();
 
         DERSequence sequence = new DERSequence();
 
         sequence.add( new DERTaggedObject( 0, DERInteger.valueOf( authenticator.getVersionNumber() ) ) );
         sequence.add( new DERTaggedObject( 1, DERGeneralString.valueOf( clientRealm ) ) );
-        sequence.add( new DERTaggedObject( 2, PrincipalNameEncoder.encode( authenticator.getClientPrincipal() ) ) );
+        sequence.add( new DERTaggedObject( 2, PrincipalNameEncoder.encode( authenticator.getClientPrincipalName() ) ) );
 
         // OPTIONAL
         if ( authenticator.getChecksum() != null )

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncKdcRepPartEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncKdcRepPartEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncKdcRepPartEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncKdcRepPartEncoder.java Mon Sep 24 03:18:05 2007
@@ -25,6 +25,7 @@
 
 import org.apache.directory.server.kerberos.shared.messages.Encodable;
 import org.apache.directory.server.kerberos.shared.messages.KdcReply;
+import org.apache.directory.server.kerberos.shared.messages.value.flags.TicketFlags;
 import org.apache.directory.shared.asn1.der.ASN1OutputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DERBitString;
@@ -92,7 +93,7 @@
             sequence.add( new DERTaggedObject( 3, KerberosTimeEncoder.encode( reply.getKeyExpiration() ) ) );
         }
 
-        sequence.add( new DERTaggedObject( 4, new DERBitString( reply.getFlags().getBytes() ) ) );
+        sequence.add( new DERTaggedObject( 4, new DERBitString( TicketFlags.getBytes( reply.getFlags() ) ) ) );
         sequence.add( new DERTaggedObject( 5, KerberosTimeEncoder.encode( reply.getAuthTime() ) ) );
 
         // OPTIONAL
@@ -110,7 +111,7 @@
         }
 
         sequence.add( new DERTaggedObject( 9, DERGeneralString.valueOf( reply.getServerRealm().toString() ) ) );
-        sequence.add( new DERTaggedObject( 10, PrincipalNameEncoder.encode( reply.getServerPrincipal() ) ) );
+        sequence.add( new DERTaggedObject( 10, PrincipalNameEncoder.encode( reply.getServerPrincipalName() ) ) );
 
         // OPTIONAL
         if ( reply.getClientAddresses() != null )

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncKrbPrivPartEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncKrbPrivPartEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncKrbPrivPartEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncKrbPrivPartEncoder.java Mon Sep 24 03:18:05 2007
@@ -87,14 +87,14 @@
             sequence.add( new DERTaggedObject( 1, KerberosTimeEncoder.encode( message.getTimestamp() ) ) );
         }
 
-        if ( message.getMicroSecond() != null )
+        if ( message.getMicroSecond() != -1 )
         {
-            sequence.add( new DERTaggedObject( 2, DERInteger.valueOf( message.getMicroSecond().intValue() ) ) );
+            sequence.add( new DERTaggedObject( 2, DERInteger.valueOf( message.getMicroSecond() ) ) );
         }
 
-        if ( message.getSequenceNumber() != null )
+        if ( message.getSequenceNumber() != -1 )
         {
-            sequence.add( new DERTaggedObject( 3, DERInteger.valueOf( message.getSequenceNumber().intValue() ) ) );
+            sequence.add( new DERTaggedObject( 3, DERInteger.valueOf( message.getSequenceNumber() ) ) );
         }
 
         sequence.add( new DERTaggedObject( 4, HostAddressesEncoder.encode( message.getSenderAddress() ) ) );

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncTicketPartEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncTicketPartEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncTicketPartEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncTicketPartEncoder.java Mon Sep 24 03:18:05 2007
@@ -25,6 +25,7 @@
 
 import org.apache.directory.server.kerberos.shared.messages.Encodable;
 import org.apache.directory.server.kerberos.shared.messages.components.EncTicketPart;
+import org.apache.directory.server.kerberos.shared.messages.value.flags.TicketFlags;
 import org.apache.directory.shared.asn1.der.ASN1OutputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DERBitString;
@@ -92,7 +93,7 @@
         sequence.add( new DERTaggedObject( 0, new DERBitString( ticketPart.getFlags().getBytes() ) ) );
         sequence.add( new DERTaggedObject( 1, EncryptionKeyEncoder.encodeSequence( ticketPart.getSessionKey() ) ) );
         sequence.add( new DERTaggedObject( 2, DERGeneralString.valueOf( ticketPart.getClientRealm().toString() ) ) );
-        sequence.add( new DERTaggedObject( 3, PrincipalNameEncoder.encode( ticketPart.getClientPrincipal() ) ) );
+        sequence.add( new DERTaggedObject( 3, PrincipalNameEncoder.encode( ticketPart.getClientPrincipalName() ) ) );
         sequence.add( new DERTaggedObject( 4, TransitedEncodingEncoder.encode( ticketPart.getTransitedEncoding() ) ) );
         sequence.add( new DERTaggedObject( 5, KerberosTimeEncoder.encode( ticketPart.getAuthTime() ) ) );
 

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedDataEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedDataEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedDataEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedDataEncoder.java Mon Sep 24 03:18:05 2007
@@ -79,7 +79,7 @@
             sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( encryptedData.getKeyVersion() ) ) );
         }
 
-        sequence.add( new DERTaggedObject( 2, new DEROctetString( encryptedData.getCipherText() ) ) );
+        sequence.add( new DERTaggedObject( 2, new DEROctetString( encryptedData.getCipher() ) ) );
 
         return sequence;
     }

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedTimestampEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedTimestampEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedTimestampEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptedTimestampEncoder.java Mon Sep 24 03:18:05 2007
@@ -24,7 +24,7 @@
 import java.io.IOException;
 
 import org.apache.directory.server.kerberos.shared.messages.Encodable;
-import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp;
+import org.apache.directory.server.kerberos.shared.messages.value.PreAuthEncryptedTimestamp;
 import org.apache.directory.shared.asn1.der.ASN1OutputStream;
 import org.apache.directory.shared.asn1.der.DERInteger;
 import org.apache.directory.shared.asn1.der.DERSequence;
@@ -42,7 +42,7 @@
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ASN1OutputStream aos = new ASN1OutputStream( baos );
 
-        aos.writeObject( encodeTimestamp( ( EncryptedTimeStamp ) encryptedTimestamp ) );
+        aos.writeObject( encodeTimestamp( ( PreAuthEncryptedTimestamp ) encryptedTimestamp ) );
         aos.close();
 
         return baos.toByteArray();
@@ -61,7 +61,7 @@
      *         pausec[1]                    INTEGER OPTIONAL
      * }
      */
-    private DERSequence encodeTimestamp( EncryptedTimeStamp encryptedTimestamp )
+    private DERSequence encodeTimestamp( PreAuthEncryptedTimestamp encryptedTimestamp )
     {
         DERSequence sequence = new DERSequence();
 

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptionTypeEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptionTypeEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptionTypeEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/EncryptionTypeEncoder.java Mon Sep 24 03:18:05 2007
@@ -20,6 +20,8 @@
 package org.apache.directory.server.kerberos.shared.io.encoder;
 
 
+import java.util.List;
+
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.shared.asn1.der.DERInteger;
 import org.apache.directory.shared.asn1.der.DERSequence;
@@ -42,6 +44,18 @@
         for ( int ii = 0; ii < eType.length; ii++ )
         {
             sequence.add( DERInteger.valueOf( eType[ii].getOrdinal() ) );
+        }
+
+        return sequence;
+    }
+
+    protected static DERSequence encode( List<EncryptionType> eTypes )
+    {
+        DERSequence sequence = new DERSequence();
+
+        for ( EncryptionType eType:eTypes )
+        {
+            sequence.add( DERInteger.valueOf( eType.getOrdinal() ) );
         }
 
         return sequence;

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/ErrorMessageEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/ErrorMessageEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/ErrorMessageEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/ErrorMessageEncoder.java Mon Sep 24 03:18:05 2007
@@ -24,7 +24,7 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
-import org.apache.directory.server.kerberos.shared.messages.ErrorMessage;
+import org.apache.directory.server.kerberos.shared.messages.KerberosError;
 import org.apache.directory.shared.asn1.der.ASN1OutputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DERGeneralString;
@@ -41,13 +41,13 @@
 public class ErrorMessageEncoder
 {
     /**
-     * Encodes an {@link ErrorMessage} into a {@link ByteBuffer}.
+     * Encodes an {@link KerberosError} into a {@link ByteBuffer}.
      *
      * @param message
      * @param out
      * @throws IOException
      */
-    public void encode( ErrorMessage message, ByteBuffer out ) throws IOException
+    public void encode( KerberosError message, ByteBuffer out ) throws IOException
     {
         ASN1OutputStream aos = new ASN1OutputStream( out );
 
@@ -59,13 +59,13 @@
 
 
     /**
-     * Encodes an {@link ErrorMessage} into a byte array.
+     * Encodes an {@link KerberosError} into a byte array.
      *
      * @param message
      * @return The byte array.
      * @throws IOException
      */
-    public byte[] encode( ErrorMessage message ) throws IOException
+    public byte[] encode( KerberosError message ) throws IOException
     {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ASN1OutputStream aos = new ASN1OutputStream( baos );
@@ -79,7 +79,7 @@
     }
 
 
-    private DERSequence encodeErrorMessageSequence( ErrorMessage message )
+    private DERSequence encodeErrorMessageSequence( KerberosError message )
     {
         DERSequence sequence = new DERSequence();
 
@@ -92,20 +92,20 @@
             sequence.add( new DERTaggedObject( 2, KerberosTimeEncoder.encode( message.getClientTime() ) ) );
         }
 
-        if ( message.getClientMicroSecond() != null )
+        if ( message.getClientMicroSecond() != -1 )
         {
-            sequence.add( new DERTaggedObject( 3, DERInteger.valueOf( message.getClientMicroSecond().intValue() ) ) );
+            sequence.add( new DERTaggedObject( 3, DERInteger.valueOf( message.getClientMicroSecond() ) ) );
         }
 
         sequence.add( new DERTaggedObject( 4, KerberosTimeEncoder.encode( message.getServerTime() ) ) );
 
         sequence.add( new DERTaggedObject( 5, DERInteger.valueOf( message.getServerMicroSecond() ) ) );
 
-        sequence.add( new DERTaggedObject( 6, DERInteger.valueOf( message.getErrorCode() ) ) );
+        sequence.add( new DERTaggedObject( 6, DERInteger.valueOf( message.getErrorCode().getOrdinal() ) ) );
 
         if ( message.getClientPrincipal() != null )
         {
-            sequence.add( new DERTaggedObject( 7, DERGeneralString.valueOf( message.getClientPrincipal().getRealm()
+            sequence.add( new DERTaggedObject( 7, DERGeneralString.valueOf( message.getClientRealm()
                 .toString() ) ) );
         }
 
@@ -114,7 +114,7 @@
             sequence.add( new DERTaggedObject( 8, PrincipalNameEncoder.encode( message.getClientPrincipal() ) ) );
         }
 
-        sequence.add( new DERTaggedObject( 9, DERGeneralString.valueOf( message.getServerPrincipal().getRealm() ) ) );
+        sequence.add( new DERTaggedObject( 9, DERGeneralString.valueOf( message.getServerRealm() ) ) );
 
         sequence.add( new DERTaggedObject( 10, PrincipalNameEncoder.encode( message.getServerPrincipal() ) ) );
 

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcReplyEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcReplyEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcReplyEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcReplyEncoder.java Mon Sep 24 03:18:05 2007
@@ -22,6 +22,7 @@
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.List;
 
 import org.apache.directory.server.kerberos.shared.messages.KdcReply;
 import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
@@ -86,7 +87,7 @@
 
         sequence.add( new DERTaggedObject( 3, DERGeneralString.valueOf( app.getClientRealm().toString() ) ) );
 
-        sequence.add( new DERTaggedObject( 4, PrincipalNameEncoder.encode( app.getClientPrincipal() ) ) );
+        sequence.add( new DERTaggedObject( 4, PrincipalNameEncoder.encode( app.getClientPrincipalName() ) ) );
 
         sequence.add( new DERTaggedObject( 5, TicketEncoder.encode( app.getTicket() ) ) );
 
@@ -102,16 +103,16 @@
      padata-value[2]       OCTET STRING,
      -- might be encoded AP-REQ
      }*/
-    private DERSequence encodePreAuthData( PreAuthenticationData[] preAuthData )
+    private DERSequence encodePreAuthData( List<PreAuthenticationData> preAuthData )
     {
         DERSequence preAuth = new DERSequence();
 
-        for ( int ii = 0; ii < preAuthData.length; ii++ )
+        for ( PreAuthenticationData data:preAuthData )
         {
             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( data.getDataType().getOrdinal() ) ) );
+            sequence.add( new DERTaggedObject( 2, new DEROctetString( data.getDataValue() ) ) );
             preAuth.add( sequence );
         }
 

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java Mon Sep 24 03:18:05 2007
@@ -23,10 +23,10 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.List;
 
 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.RequestBody;
 import org.apache.directory.shared.asn1.der.ASN1OutputStream;
 import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
 import org.apache.directory.shared.asn1.der.DERBitString;
@@ -83,7 +83,7 @@
             sequence.add( new DERTaggedObject( 3, encodePreAuthData( app.getPreAuthData() ) ) );
         }
 
-        sequence.add( new DERTaggedObject( 4, encodeKdcRequestBody( app.getRequestBody() ) ) );
+        sequence.add( new DERTaggedObject( 4, encodeKdcRequestBody( app ) ) );
 
         return sequence;
     }
@@ -92,16 +92,16 @@
     /**
      * Encodes a {@link KdcRequest} into a byte[].
      *
-     * @param requestBody
+     * @param request
      * @return The encoded {@link KdcRequest}.
      * @throws IOException
      */
-    public byte[] encodeRequestBody( RequestBody requestBody ) throws IOException
+    public byte[] encodeBody( KdcRequest request ) throws IOException
     {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ASN1OutputStream aos = new ASN1OutputStream( baos );
 
-        aos.writeObject( encodeKdcRequestBody( requestBody ) );
+        aos.writeObject( encodeKdcRequestBody( request ) );
         aos.close();
 
         return baos.toByteArray();
@@ -129,63 +129,61 @@
      *     additional-tickets[11]       SEQUENCE OF Ticket OPTIONAL
      * }
      */
-    private DERSequence encodeKdcRequestBody( RequestBody requestBody )
+    public DERSequence encodeKdcRequestBody( KdcRequest request )
     {
         DERSequence sequence = new DERSequence();
 
-        sequence.add( new DERTaggedObject( 0, new DERBitString( requestBody.getKdcOptions().getBytes() ) ) );
+        sequence.add( new DERTaggedObject( 0, new DERBitString( request.getKdcOptions().getData() ) ) );
 
         // OPTIONAL
-        if ( requestBody.getClientPrincipal() != null )
+        if ( request.getClientPrincipal() != null )
         {
-            sequence.add( new DERTaggedObject( 1, PrincipalNameEncoder.encode( requestBody.getClientPrincipal() ) ) );
+            sequence.add( new DERTaggedObject( 1, PrincipalNameEncoder.encode( request.getClientPrincipalName() ) ) );
         }
 
-        sequence.add( new DERTaggedObject( 2, DERGeneralString.valueOf( requestBody.getServerPrincipal().getRealm()
-            .toString() ) ) );
+        sequence.add( new DERTaggedObject( 2, DERGeneralString.valueOf( request.getRealm().toString() ) ) );
 
         // OPTIONAL
-        if ( requestBody.getServerPrincipal() != null )
+        if ( request.getServerPrincipal() != null )
         {
-            sequence.add( new DERTaggedObject( 3, PrincipalNameEncoder.encode( requestBody.getServerPrincipal() ) ) );
+            sequence.add( new DERTaggedObject( 3, PrincipalNameEncoder.encode( request.getServerPrincipalName() ) ) );
         }
 
         // OPTIONAL
-        if ( requestBody.getFrom() != null )
+        if ( request.getFrom() != null )
         {
-            sequence.add( new DERTaggedObject( 4, KerberosTimeEncoder.encode( requestBody.getFrom() ) ) );
+            sequence.add( new DERTaggedObject( 4, KerberosTimeEncoder.encode( request.getFrom() ) ) );
         }
 
-        sequence.add( new DERTaggedObject( 5, KerberosTimeEncoder.encode( requestBody.getTill() ) ) );
+        sequence.add( new DERTaggedObject( 5, KerberosTimeEncoder.encode( request.getTill() ) ) );
 
         // OPTIONAL
-        if ( requestBody.getRtime() != null )
+        if ( request.getRenewtime() != null )
         {
-            sequence.add( new DERTaggedObject( 6, KerberosTimeEncoder.encode( requestBody.getRtime() ) ) );
+            sequence.add( new DERTaggedObject( 6, KerberosTimeEncoder.encode( request.getRenewtime() ) ) );
         }
 
-        sequence.add( new DERTaggedObject( 7, DERInteger.valueOf( requestBody.getNonce() ) ) );
+        sequence.add( new DERTaggedObject( 7, DERInteger.valueOf( request.getNonce() ) ) );
 
-        sequence.add( new DERTaggedObject( 8, EncryptionTypeEncoder.encode( requestBody.getEType() ) ) );
+        sequence.add( new DERTaggedObject( 8, EncryptionTypeEncoder.encode( request.getEType() ) ) );
 
         // OPTIONAL
-        if ( requestBody.getAddresses() != null )
+        if ( request.getAddresses() != null )
         {
-            sequence.add( new DERTaggedObject( 9, HostAddressesEncoder.encodeSequence( requestBody.getAddresses() ) ) );
+            sequence.add( new DERTaggedObject( 9, HostAddressesEncoder.encodeSequence( request.getAddresses() ) ) );
         }
 
         // OPTIONAL
-        if ( requestBody.getEncAuthorizationData() != null )
+        if ( request.getEncAuthorizationData() != null )
         {
-            sequence.add( new DERTaggedObject( 10, EncryptedDataEncoder.encodeSequence( requestBody
+            sequence.add( new DERTaggedObject( 10, EncryptedDataEncoder.encodeSequence( request
                 .getEncAuthorizationData() ) ) );
         }
 
         // OPTIONAL
-        if ( requestBody.getAdditionalTickets() != null )
+        if ( request.getAdditionalTickets() != null )
         {
-            sequence
-                .add( new DERTaggedObject( 11, TicketEncoder.encodeSequence( requestBody.getAdditionalTickets() ) ) );
+            sequence.add( new DERTaggedObject( 11, TicketEncoder.encodeSequence( request.getAdditionalTickets() ) ) );
         }
 
         return sequence;
@@ -198,16 +196,16 @@
      padata-value[2]       OCTET STRING,
      -- might be encoded AP-REQ
      }*/
-    private DERSequence encodePreAuthData( PreAuthenticationData[] preAuthData )
+    private DERSequence encodePreAuthData( List<PreAuthenticationData> preAuthData )
     {
         DERSequence preAuth = new DERSequence();
 
-        for ( int ii = 0; ii < preAuthData.length; ii++ )
+        for ( PreAuthenticationData paData:preAuthData )
         {
             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( paData.getDataType().getOrdinal() ) ) );
+            sequence.add( new DERTaggedObject( 2, new DEROctetString( paData.getDataValue() ) ) );
             preAuth.add( sequence );
         }
 

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/PrincipalNameEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/PrincipalNameEncoder.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/PrincipalNameEncoder.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/PrincipalNameEncoder.java Mon Sep 24 03:18:05 2007
@@ -20,12 +20,6 @@
 package org.apache.directory.server.kerberos.shared.io.encoder;
 
 
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.security.auth.kerberos.KerberosPrincipal;
-
 import org.apache.directory.server.kerberos.shared.messages.value.PrincipalName;
 import org.apache.directory.shared.asn1.der.DERGeneralString;
 import org.apache.directory.shared.asn1.der.DERInteger;
@@ -39,90 +33,35 @@
  */
 public class PrincipalNameEncoder
 {
-    private static final String COMPONENT_SEPARATOR = "/";
-    private static final String REALM_SEPARATOR = "@";
-
-
     /**
-     * Encodes a {@link KerberosPrincipal} into a {@link DERSequence}.
-     * 
      * PrincipalName ::=   SEQUENCE {
      *               name-type[0]     INTEGER,
      *               name-string[1]   SEQUENCE OF GeneralString
      * }
      * 
      * @param principal 
-     * @return The {@link DERSequence}.
+     * @return The {@link DERSequence}. 
      */
-    public static DERSequence encode( KerberosPrincipal principal )
+    public static DERSequence encode( PrincipalName principal )
     {
         DERSequence vector = new DERSequence();
 
-        vector.add( new DERTaggedObject( 0, DERInteger.valueOf( principal.getNameType() ) ) );
+        vector.add( new DERTaggedObject( 0, DERInteger.valueOf( principal.getNameType().getOrdinal() ) ) );
         vector.add( new DERTaggedObject( 1, encodeNameSequence( principal ) ) );
 
         return vector;
     }
 
 
-    /**
-     * Encodes a {@link PrincipalName} into a {@link DERSequence}.
-     *
-     * @param name
-     * @return The {@link DERSequence}.
-     */
-    public static DERSequence encode( PrincipalName name )
-    {
-        DERSequence vector = new DERSequence();
-
-        vector.add( new DERTaggedObject( 0, DERInteger.valueOf( name.getNameType() ) ) );
-        vector.add( new DERTaggedObject( 1, encodeNameSequence( name ) ) );
-
-        return vector;
-    }
-
-
-    private static DERSequence encodeNameSequence( KerberosPrincipal principal )
+    private static DERSequence encodeNameSequence( PrincipalName principalName )
     {
-        Iterator<String> it = getNameStrings( principal ).iterator();
-
         DERSequence vector = new DERSequence();
 
-        while ( it.hasNext() )
+        for ( String name:principalName.getNameString() )
         {
-            vector.add( DERGeneralString.valueOf( it.next() ) );
+            vector.add( DERGeneralString.valueOf( name ) );
         }
 
         return vector;
-    }
-
-
-    private static List<String> getNameStrings( KerberosPrincipal principal )
-    {
-        String nameComponent = principal.getName().split( REALM_SEPARATOR )[0];
-        String[] components = nameComponent.split( COMPONENT_SEPARATOR );
-        return Arrays.asList( components );
-    }
-
-
-    private static DERSequence encodeNameSequence( PrincipalName name )
-    {
-        Iterator<String> it = getNameStrings( name ).iterator();
-
-        DERSequence vector = new DERSequence();
-
-        while ( it.hasNext() )
-        {
-            vector.add( DERGeneralString.valueOf( it.next() ) );
-        }
-
-        return vector;
-    }
-
-
-    private static List<String> getNameStrings( PrincipalName name )
-    {
-        String[] components = name.getNameComponent().split( COMPONENT_SEPARATOR );
-        return Arrays.asList( components );
     }
 }



Mime
View raw message