directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1039717 - in /directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec: EncKdcRepPart/actions/ adKdcIssued/actions/ authenticator/actions/ encTicketPart/actions/ kdcRep/actions/ kdcReqBody/actions/ k...
Date Sat, 27 Nov 2010 18:40:56 GMT
Author: elecharny
Date: Sat Nov 27 18:40:56 2010
New Revision: 1039717

URL: http://svn.apache.org/viewvc?rev=1039717&view=rev
Log:
Used the AbstractReadPrincipalame everywhere

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/EncKdcRepPart/actions/StoreSName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreISName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authenticator/actions/StoreCName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/actions/StoreCName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReqBody/actions/StoreCName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReqBody/actions/StoreSName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCredInfo/actions/StorePName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCredInfo/actions/StoreSName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StoreCName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StoreSName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreSName.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/EncKdcRepPart/actions/StoreSName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/EncKdcRepPart/actions/StoreSName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/EncKdcRepPart/actions/StoreSName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/EncKdcRepPart/actions/StoreSName.java
Sat Nov 27 18:40:56 2010
@@ -21,17 +21,9 @@ package org.apache.directory.shared.kerb
 
 
 import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
-import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.codec.EncKdcRepPart.EncKdcRepPartContainer;
-import org.apache.directory.shared.kerberos.codec.principalName.PrincipalNameContainer;
-import org.apache.directory.shared.kerberos.components.EncKdcRepPart;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadPrincipalName;
 import org.apache.directory.shared.kerberos.components.PrincipalName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -39,15 +31,8 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreSName extends GrammarAction
+public class StoreSName extends AbstractReadPrincipalName
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( StoreSName.class );
-
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
-
     /**
      * Instantiates a new StoreSName action.
      */
@@ -60,52 +45,11 @@ public class StoreSName extends GrammarA
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    @Override
+    protected void setPrincipalName( PrincipalName principalName, Asn1Container container
)
     {
         EncKdcRepPartContainer encKdcRepPartContainer = ( EncKdcRepPartContainer ) container;
-
-        TLV tlv = encKdcRepPartContainer.getCurrentTLV();
-
-        // The Length should not be null
-        if ( tlv.getLength() == 0 )
-        {
-            LOG.error( I18n.err( I18n.ERR_04066 ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
-        }
-        
-        // Now, let's decode the PrincipalName
-        Asn1Decoder principalNameDecoder = new Asn1Decoder();
-        
-        PrincipalNameContainer principalNameContainer = new PrincipalNameContainer();
-
-        // Decode the PrincipalName PDU
-        try
-        {
-            principalNameDecoder.decode( container.getStream(), principalNameContainer );
-        }
-        catch ( DecoderException de )
-        {
-            throw de;
-        }
-
-        // Store the Principal name in the container
-        PrincipalName principalName = principalNameContainer.getPrincipalName();
-        EncKdcRepPart encKdcRepPart = encKdcRepPartContainer.getEncKdcRepPart();
-        encKdcRepPart.setSName( principalName );
-        
-        // Update the expected length for the current TLV
-        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
-
-        // Update the parent
-        container.updateParent();
-
-        if ( IS_DEBUG )
-        {
-            LOG.debug( "SName : {}", principalName );
-        }
-        
+        encKdcRepPartContainer.getEncKdcRepPart().setSName( principalName );
         encKdcRepPartContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreISName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreISName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreISName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreISName.java
Sat Nov 27 18:40:56 2010
@@ -33,7 +33,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StoreISName extends AbstractReadPrincipalName
 {
-
     /**
      * Instantiates a new StoreISName action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authenticator/actions/StoreCName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authenticator/actions/StoreCName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authenticator/actions/StoreCName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authenticator/actions/StoreCName.java
Sat Nov 27 18:40:56 2010
@@ -33,7 +33,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StoreCName extends AbstractReadPrincipalName
 {
-
     /**
      * Instantiates a new StoreCName action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCName.java
Sat Nov 27 18:40:56 2010
@@ -33,7 +33,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StoreCName extends AbstractReadPrincipalName
 {
-
     /**
      * Instantiates a new StoreCName action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/actions/StoreCName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/actions/StoreCName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/actions/StoreCName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/actions/StoreCName.java
Sat Nov 27 18:40:56 2010
@@ -27,13 +27,12 @@ import org.apache.directory.shared.kerbe
 
 
 /**
- * The action used to store the CName
+ * The action used to store the KDC-REP CName
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class StoreCName extends AbstractReadPrincipalName
 {
-
     /**
      * Instantiates a new StoreCName action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReqBody/actions/StoreCName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReqBody/actions/StoreCName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReqBody/actions/StoreCName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReqBody/actions/StoreCName.java
Sat Nov 27 18:40:56 2010
@@ -21,33 +21,18 @@ package org.apache.directory.shared.kerb
 
 
 import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
-import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadPrincipalName;
 import org.apache.directory.shared.kerberos.codec.kdcReqBody.KdcReqBodyContainer;
-import org.apache.directory.shared.kerberos.codec.principalName.PrincipalNameContainer;
-import org.apache.directory.shared.kerberos.components.KdcReqBody;
 import org.apache.directory.shared.kerberos.components.PrincipalName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
- * The action used to store the CName
+ * The action used to store the KDC-REQ-BODY CName
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreCName extends GrammarAction
+public class StoreCName extends AbstractReadPrincipalName
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( StoreCName.class );
-
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
-
     /**
      * Instantiates a new StoreCName action.
      */
@@ -56,54 +41,13 @@ public class StoreCName extends GrammarA
         super( "Stores the CName" );
     }
 
-
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    @Override
+    protected void setPrincipalName( PrincipalName principalName, Asn1Container container
)
     {
         KdcReqBodyContainer kdcReqBodyContainer = ( KdcReqBodyContainer ) container;
-
-        TLV tlv = kdcReqBodyContainer.getCurrentTLV();
-
-        // The Length should not be null
-        if ( tlv.getLength() == 0 )
-        {
-            LOG.error( I18n.err( I18n.ERR_04066 ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
-        }
-        
-        // Now, let's decode the PrincipalName
-        Asn1Decoder principalNameDecoder = new Asn1Decoder();
-        
-        PrincipalNameContainer principalNameContainer = new PrincipalNameContainer();
-
-        // Decode the PrincipalName PDU
-        try
-        {
-            principalNameDecoder.decode( container.getStream(), principalNameContainer );
-        }
-        catch ( DecoderException de )
-        {
-            throw de;
-        }
-
-        // Store the Principal name in the container
-        PrincipalName principalName = principalNameContainer.getPrincipalName();
-        KdcReqBody kdcReqBody = kdcReqBodyContainer.getKdcReqBody();
-        kdcReqBody.setCName( principalName );
-        
-        // Update the expected length for the current TLV
-        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
-
-        // Update the parent
-        container.updateParent();
-
-        if ( IS_DEBUG )
-        {
-            LOG.debug( "CName : {}", principalName );
-        }
+        kdcReqBodyContainer.getKdcReqBody().setCName( principalName );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReqBody/actions/StoreSName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReqBody/actions/StoreSName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReqBody/actions/StoreSName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReqBody/actions/StoreSName.java
Sat Nov 27 18:40:56 2010
@@ -21,17 +21,9 @@ package org.apache.directory.shared.kerb
 
 
 import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
-import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadPrincipalName;
 import org.apache.directory.shared.kerberos.codec.kdcReqBody.KdcReqBodyContainer;
-import org.apache.directory.shared.kerberos.codec.principalName.PrincipalNameContainer;
-import org.apache.directory.shared.kerberos.components.KdcReqBody;
 import org.apache.directory.shared.kerberos.components.PrincipalName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -39,15 +31,8 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreSName extends GrammarAction
+public class StoreSName extends AbstractReadPrincipalName
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( StoreSName.class );
-
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
-
     /**
      * Instantiates a new StoreSName action.
      */
@@ -60,50 +45,10 @@ public class StoreSName extends GrammarA
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    @Override
+    protected void setPrincipalName( PrincipalName principalName, Asn1Container container
)
     {
         KdcReqBodyContainer kdcReqBodyContainer = ( KdcReqBodyContainer ) container;
-
-        TLV tlv = kdcReqBodyContainer.getCurrentTLV();
-
-        // The Length should not be null
-        if ( tlv.getLength() == 0 )
-        {
-            LOG.error( I18n.err( I18n.ERR_04066 ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
-        }
-        
-        // Now, let's decode the PrincipalName
-        Asn1Decoder principalNameDecoder = new Asn1Decoder();
-        
-        PrincipalNameContainer principalNameContainer = new PrincipalNameContainer();
-
-        // Decode the PrincipalName PDU
-        try
-        {
-            principalNameDecoder.decode( container.getStream(), principalNameContainer );
-        }
-        catch ( DecoderException de )
-        {
-            throw de;
-        }
-
-        // Store the Principal name in the container
-        PrincipalName principalName = principalNameContainer.getPrincipalName();
-        KdcReqBody kdcReqBody = kdcReqBodyContainer.getKdcReqBody();
-        kdcReqBody.setSName( principalName );
-        
-        // Update the expected length for the current TLV
-        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
-
-        // Update the parent
-        container.updateParent();
-
-        if ( IS_DEBUG )
-        {
-            LOG.debug( "SName : {}", principalName );
-        }
+        kdcReqBodyContainer.getKdcReqBody().setSName( principalName );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCredInfo/actions/StorePName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCredInfo/actions/StorePName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCredInfo/actions/StorePName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCredInfo/actions/StorePName.java
Sat Nov 27 18:40:56 2010
@@ -33,7 +33,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StorePName extends AbstractReadPrincipalName
 {
-
     /**
      * Instantiates a new StorePName action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCredInfo/actions/StoreSName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCredInfo/actions/StoreSName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCredInfo/actions/StoreSName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCredInfo/actions/StoreSName.java
Sat Nov 27 18:40:56 2010
@@ -33,7 +33,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StoreSName extends AbstractReadPrincipalName
 {
-
     /**
      * Instantiates a new StoreSName action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StoreCName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StoreCName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StoreCName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StoreCName.java
Sat Nov 27 18:40:56 2010
@@ -33,7 +33,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StoreCName extends AbstractReadPrincipalName
 {
-
     /**
      * Instantiates a new StoreCName action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StoreSName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StoreSName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StoreSName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StoreSName.java
Sat Nov 27 18:40:56 2010
@@ -33,7 +33,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StoreSName extends AbstractReadPrincipalName
 {
-
     /**
      * Instantiates a new StoreSName action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreSName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreSName.java?rev=1039717&r1=1039716&r2=1039717&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreSName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreSName.java
Sat Nov 27 18:40:56 2010
@@ -33,7 +33,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StoreSName extends AbstractReadPrincipalName
 {
-
     /**
      * Instantiates a new StoreSName action.
      */



Mime
View raw message