directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1039483 - in /directory/apacheds/trunk/kerberos-codec/src: main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/ main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/ test/java/org/apache/directory/share...
Date Fri, 26 Nov 2010 17:57:14 GMT
Author: kayyagari
Date: Fri Nov 26 17:57:13 2010
New Revision: 1039483

URL: http://svn.apache.org/viewvc?rev=1039483&view=rev
Log:
o implementation of EncTicketPart's grammar, associated actions and test cases

Added:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartContainer.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartGrammar.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartStatesEnum.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/EncTicketPartInit.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreAuthTime.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreAuthorizationData.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/encTicketPart/actions/StoreCRealm.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreClientAddresses.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreEndTime.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreFlags.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreKey.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreRenewtill.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreStartTime.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreTransited.java
    directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncTicketPartDecoderTest.java

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartContainer.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartContainer.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartContainer.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,66 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart;
+
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
+import org.apache.directory.shared.kerberos.components.EncTicketPart;
+
+
+/**
+ * The EncTicketPart container stores the EncTicketPart decoded by the Asn1Decoder.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EncTicketPartContainer extends AbstractContainer
+{
+    /** holds EncTicketPart */
+    private EncTicketPart encTicketPart = new EncTicketPart();
+
+    /**
+     * Creates a new EncTicketPartContainer object.
+     */
+    public EncTicketPartContainer()
+    {
+        super();
+        this.stateStack = new int[1];
+        this.grammar = EncTicketPartGrammar.getInstance();
+        setTransition( EncTicketPartStatesEnum.START_STATE );
+    }
+
+
+    /**
+     * @return Returns the EncTicketPart.
+     */
+    public EncTicketPart getEncTicketPart()
+    {
+        return encTicketPart;
+    }
+
+    
+    /**
+     * Set a EncTicketPart Object into the container
+     * 
+     * @param encTicketPart The EncTicketPart to set.
+     */
+    public void setEncTicketPart( EncTicketPart encTicketPart )
+    {
+        this.encTicketPart = encTicketPart;
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartGrammar.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartGrammar.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartGrammar.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,180 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart;
+
+
+import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
+import org.apache.directory.shared.asn1.ber.grammar.Grammar;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
+import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
+import org.apache.directory.shared.kerberos.KerberosConstants;
+import org.apache.directory.shared.kerberos.codec.actions.CheckNotNullLength;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.EncTicketPartInit;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreAuthTime;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreAuthorizationData;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreCName;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreCRealm;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreClientAddresses;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreEndTime;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreFlags;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreKey;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreRenewtill;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreStartTime;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.actions.StoreTransited;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class implements the EncTicketPart structure. All the actions are declared
+ * in this class. As it is a singleton, these declaration are only done once. If
+ * an action is to be added or modified, this is where the work is to be done !
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class EncTicketPartGrammar extends AbstractGrammar
+{
+    /** The logger */
+    static final Logger LOG = LoggerFactory.getLogger( EncTicketPartGrammar.class );
+
+    /** A speedup for logger */
+    static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+    /** The instance of grammar. EncTicketPartGrammar is a singleton */
+    private static Grammar instance = new EncTicketPartGrammar();
+
+
+    /**
+     * Creates a new EncTicketPartGrammar object.
+     */
+    private EncTicketPartGrammar()
+    {
+        setName( EncTicketPartGrammar.class.getName() );
+
+        // Create the transitions table
+        super.transitions = new GrammarTransition[EncTicketPartStatesEnum.LAST_ENC_TICKET_PART_STATE.ordinal()][256];
+
+        // ============================================================================================
+        // EncTicketPart
+        // ============================================================================================
+        super.transitions[EncTicketPartStatesEnum.START_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.START_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_TAG_STATE, KerberosConstants.ENC_TICKET_PART_TAG,
+            new EncTicketPartInit());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_TAG_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
+            new CheckNotNullLength());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_SEQ_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_FLAGS_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_SEQ_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_FLAGS_TAG_STATE, KerberosConstants.ENC_TICKET_PART_FLAGS_TAG,
+            new CheckNotNullLength());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_FLAGS_TAG_STATE.ordinal()][UniversalTag.BIT_STRING.getValue()] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_FLAGS_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_FLAGS_STATE, UniversalTag.BIT_STRING.getValue(),
+            new StoreFlags());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_FLAGS_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_KEY_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_FLAGS_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_KEY_TAG_STATE, KerberosConstants.ENC_TICKET_PART_KEY_TAG,
+            new StoreKey());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_KEY_TAG_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_CREALM_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_KEY_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_CREALM_TAG_STATE, KerberosConstants.ENC_TICKET_PART_CREALM_TAG,
+            new CheckNotNullLength());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_CREALM_TAG_STATE.ordinal()][UniversalTag.GENERAL_STRING.getValue()] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_CREALM_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_CREALM_STATE, UniversalTag.GENERAL_STRING.getValue(),
+            new StoreCRealm());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_CREALM_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_CNAME_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_CREALM_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_CNAME_TAG_STATE, KerberosConstants.ENC_TICKET_PART_CNAME_TAG,
+            new StoreCName());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_CNAME_TAG_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_TRANSITED_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_CNAME_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_TRANSITED_TAG_STATE, KerberosConstants.ENC_TICKET_PART_TRANSITED_TAG,
+            new StoreTransited());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_TRANSITED_TAG_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_AUTHTIME_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_TRANSITED_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHTIME_TAG_STATE, KerberosConstants.ENC_TICKET_PART_AUTHTIME_TAG,
+            new CheckNotNullLength());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHTIME_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHTIME_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHTIME_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
+            new StoreAuthTime());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHTIME_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_STARTTIME_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHTIME_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_STARTTIME_TAG_STATE, KerberosConstants.ENC_TICKET_PART_STARTTIME_TAG,
+            new CheckNotNullLength());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_STARTTIME_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_STARTTIME_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_STARTTIME_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
+            new StoreStartTime());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_STARTTIME_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_ENDTIME_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_STARTTIME_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_TAG_STATE, KerberosConstants.ENC_TICKET_PART_ENDTIME_TAG,
+            new CheckNotNullLength());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
+            new StoreEndTime());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_RENEWTILL_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_RENEWTILL_TAG_STATE, KerberosConstants.ENC_TICKET_PART_RENEWTILL_TAG,
+            new CheckNotNullLength());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_RENEWTILL_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_RENEWTILL_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_RENEWTILL_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
+            new StoreRenewtill());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_RENEWTILL_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_CADDR_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_RENEWTILL_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_CADDR_TAG_STATE, KerberosConstants.ENC_TICKET_PART_CADDR_TAG,
+            new StoreClientAddresses());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_CADDR_TAG_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_AUTHORIZATION_DATA_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_CADDR_TAG_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHZ_DATA_TAG_STATE, KerberosConstants.ENC_TICKET_PART_AUTHORIZATION_DATA_TAG,
+            new StoreAuthorizationData());
+
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHTIME_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_ENDTIME_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHTIME_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_TAG_STATE, KerberosConstants.ENC_TICKET_PART_ENDTIME_TAG,
+            new CheckNotNullLength());
+
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_CADDR_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_CADDR_TAG_STATE, KerberosConstants.ENC_TICKET_PART_CADDR_TAG,
+            new StoreClientAddresses());
+        
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_AUTHORIZATION_DATA_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_ENDTIME_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHZ_DATA_TAG_STATE, KerberosConstants.ENC_TICKET_PART_AUTHORIZATION_DATA_TAG,
+            new StoreAuthorizationData());
+
+        super.transitions[EncTicketPartStatesEnum.ENC_TICKET_PART_RENEWTILL_STATE.ordinal()][KerberosConstants.ENC_TICKET_PART_AUTHORIZATION_DATA_TAG] = new GrammarTransition(
+            EncTicketPartStatesEnum.ENC_TICKET_PART_RENEWTILL_STATE, EncTicketPartStatesEnum.ENC_TICKET_PART_AUTHZ_DATA_TAG_STATE, KerberosConstants.ENC_TICKET_PART_AUTHORIZATION_DATA_TAG,
+            new StoreAuthorizationData());
+    }
+
+
+    /**
+     * Get the instance of this grammar
+     * 
+     * @return An instance on the EncTicketPart Grammar
+     */
+    public static Grammar getInstance()
+    {
+        return instance;
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartStatesEnum.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartStatesEnum.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/EncTicketPartStatesEnum.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,134 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart;
+
+
+import org.apache.directory.shared.asn1.ber.grammar.Grammar;
+import org.apache.directory.shared.asn1.ber.grammar.States;
+import org.apache.directory.shared.kerberos.codec.KerberosMessageGrammar;
+
+
+/**
+ * This class store the EncTicketPart grammar's constants. It is also used for debugging
+ * purpose
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public enum EncTicketPartStatesEnum implements States
+{
+    // Start
+    START_STATE,                        // 0
+    
+    ENC_TICKET_PART_TAG_STATE,          // 1
+    
+    ENC_TICKET_PART_SEQ_STATE,          // 2
+    
+    ENC_TICKET_PART_FLAGS_TAG_STATE,    // 3
+    ENC_TICKET_PART_FLAGS_STATE,        // 4
+    
+    ENC_TICKET_PART_KEY_TAG_STATE,      // 5
+    
+    ENC_TICKET_PART_CREALM_TAG_STATE,   // 6
+    ENC_TICKET_PART_CREALM_STATE,       // 7
+    
+    ENC_TICKET_PART_CNAME_TAG_STATE,    // 8
+    
+    ENC_TICKET_PART_TRANSITED_TAG_STATE,// 9
+    
+    ENC_TICKET_PART_AUTHTIME_TAG_STATE, // 10
+    ENC_TICKET_PART_AUTHTIME_STATE,     // 11
+    
+    ENC_TICKET_PART_STARTTIME_TAG_STATE,// 12
+    ENC_TICKET_PART_STARTTIME_STATE,    // 13
+    
+    ENC_TICKET_PART_ENDTIME_TAG_STATE,  // 14
+    ENC_TICKET_PART_ENDTIME_STATE,      // 15
+    
+    ENC_TICKET_PART_RENEWTILL_TAG_STATE,// 16
+    ENC_TICKET_PART_RENEWTILL_STATE,    // 17
+    
+    ENC_TICKET_PART_CADDR_TAG_STATE,    // 18
+    
+    ENC_TICKET_PART_AUTHZ_DATA_TAG_STATE,// 19
+    
+    // End
+    LAST_ENC_TICKET_PART_STATE;         // 20
+
+    
+    /**
+     * Get the grammar name
+     * 
+     * @param grammar The grammar code
+     * @return The grammar name
+     */
+    public String getGrammarName( int grammar )
+    {
+        return "ENC_TICKET_PART_GRAMMAR";
+    }
+
+
+    /**
+     * Get the grammar name
+     * 
+     * @param grammar The grammar class
+     * @return The grammar name
+     */
+    public String getGrammarName( Grammar grammar )
+    {
+        if ( grammar instanceof KerberosMessageGrammar )
+        {
+            return "ENC_TICKET_PART_GRAMMAR";
+        }
+        else
+        {
+            return "UNKNOWN GRAMMAR";
+        }
+    }
+
+
+    /**
+     * Get the string representing the state
+     * 
+     * @param state The state number
+     * @return The String representing the state
+     */
+    public String getState( int state )
+    {
+        return ( ( state == LAST_ENC_TICKET_PART_STATE.ordinal() ) ? "LAST_ENC_TICKET_PART_STATE" : name() );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEndState()
+    {
+        return this == LAST_ENC_TICKET_PART_STATE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public EncTicketPartStatesEnum getStartState()
+    {
+        return START_STATE;
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/EncTicketPartInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/EncTicketPartInit.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/EncTicketPartInit.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/EncTicketPartInit.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,83 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+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.encTicketPart.EncTicketPartContainer;
+import org.apache.directory.shared.kerberos.components.EncTicketPart;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the EncTicketPart object
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EncTicketPartInit extends GrammarAction
+{
+    /** The logger */
+    private static final Logger LOG = LoggerFactory.getLogger( EncTicketPartInit.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+
+    /**
+     * Instantiates a new EncTicketPartInit action.
+     */
+    public EncTicketPartInit()
+    {
+        super( "Creates a EncTicketPart instance" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void action( Asn1Container container ) throws DecoderException
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+
+        TLV tlv = encTicketPartContainer.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 ) );
+        }
+        
+        EncTicketPart encTicketPart = new EncTicketPart();
+        encTicketPartContainer.setEncTicketPart( encTicketPart );
+        
+        if ( IS_DEBUG )
+        {
+            LOG.debug( "EncTicketPart created" );
+        }
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreAuthTime.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreAuthTime.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreAuthTime.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreAuthTime.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.KerberosTime;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadKerberosTime;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+
+
+/**
+ * The action used to store the authtime KerberosTime
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreAuthTime extends AbstractReadKerberosTime
+{
+
+    /**
+     * Instantiates a new StoreAuthTime action.
+     */
+    public StoreAuthTime()
+    {
+        super( "Stores the authtime" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setKerberosTime( KerberosTime krbtime, Asn1Container container )
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+        encTicketPartContainer.getEncTicketPart().setAuthTime( krbtime );
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreAuthorizationData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreAuthorizationData.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreAuthorizationData.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreAuthorizationData.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadAuthorizationData;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+import org.apache.directory.shared.kerberos.components.AuthorizationData;
+
+
+/**
+ * The action used to set the EncTicketPart authorization-data
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreAuthorizationData extends AbstractReadAuthorizationData
+{
+
+    /**
+     * Instantiates a new StoreAuthorizationData action.
+     */
+    public StoreAuthorizationData()
+    {
+        super( "EncTicketPart authorization-data" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setAuthorizationData( AuthorizationData authorizationData, Asn1Container container )
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+        encTicketPartContainer.getEncTicketPart().setAuthorizationData( authorizationData );
+        encTicketPartContainer.setGrammarEndAllowed( true );
+    }
+}

Added: 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=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCName.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCName.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadPrincipalName;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+import org.apache.directory.shared.kerberos.components.PrincipalName;
+
+
+/**
+ * The action used to set the EncTicketPart cName
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreCName extends AbstractReadPrincipalName
+{
+
+    /**
+     * Instantiates a new StoreCName action.
+     */
+    public StoreCName()
+    {
+        super( "EncTicketPart cname" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setPrincipalName( PrincipalName principalName, Asn1Container container )
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+        encTicketPartContainer.getEncTicketPart().setcName( principalName );
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCRealm.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCRealm.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCRealm.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreCRealm.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadRealm;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+
+
+/**
+ * The action used to set the cRealm
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreCRealm extends AbstractReadRealm
+{
+
+    /**
+     * Instantiates a new StoreCRealm action.
+     */
+    public StoreCRealm()
+    {
+        super( "EncTicketPart crealm value" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setRealm( String realm, Asn1Container container )
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+        encTicketPartContainer.getEncTicketPart().setcRealm( realm );
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreClientAddresses.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreClientAddresses.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreClientAddresses.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreClientAddresses.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadHostAddresses;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+import org.apache.directory.shared.kerberos.components.HostAddresses;
+
+
+/**
+ * The action used to store the ClientAddresses (caddr)
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreClientAddresses extends AbstractReadHostAddresses
+{
+
+    /**
+     * Instantiates a new StoreClientAddresses action.
+     */
+    public StoreClientAddresses()
+    {
+        super( "EncTicketPart caddr" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setHostAddresses( HostAddresses hostAddresses, Asn1Container container )
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+        encTicketPartContainer.getEncTicketPart().setClientAddresses( hostAddresses );
+        
+        container.setGrammarEndAllowed( true );
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreEndTime.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreEndTime.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreEndTime.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreEndTime.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.KerberosTime;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadKerberosTime;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+
+
+/**
+ * The action used to store the endtime KerberosTime
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreEndTime extends AbstractReadKerberosTime
+{
+
+    /**
+     * Instantiates a new StoreEndTime action.
+     */
+    public StoreEndTime()
+    {
+        super( "Stores the endtime" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setKerberosTime( KerberosTime krbtime, Asn1Container container )
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+        encTicketPartContainer.getEncTicketPart().setEndTime( krbtime );
+        
+        container.setGrammarEndAllowed( true );
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreFlags.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreFlags.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreFlags.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreFlags.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadByteArray;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+import org.apache.directory.shared.kerberos.flags.TicketFlags;
+
+
+/**
+ * The action used to store the TicketFlags
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreFlags extends AbstractReadByteArray
+{
+
+    /**
+     * Instantiates a new StoreFlagss action.
+     */
+    public StoreFlags()
+    {
+        super( "Store EncTicketPart's flags" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setByteArry( byte[] data, Asn1Container container )
+    {
+        TicketFlags flags = new TicketFlags( data );
+        EncTicketPartContainer encTickerPartContainer = ( EncTicketPartContainer ) container;
+        encTickerPartContainer.getEncTicketPart().setFlags( flags );
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreKey.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreKey.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreKey.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreKey.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadEncryptionKey;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+import org.apache.directory.shared.kerberos.components.EncryptionKey;
+
+
+/**
+ * The action used to set the EncTicketPart key
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreKey extends AbstractReadEncryptionKey
+{
+
+    /**
+     * Instantiates a new StoreKey action.
+     */
+    public StoreKey()
+    {
+        super( "EncTicketPart key" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setEncryptionKey( EncryptionKey encryptionKey, Asn1Container container )
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+        encTicketPartContainer.getEncTicketPart().setKey( encryptionKey );
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreRenewtill.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreRenewtill.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreRenewtill.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreRenewtill.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.KerberosTime;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadKerberosTime;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+
+
+/**
+ * The action used to store the renew-till KerberosTime
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreRenewtill extends AbstractReadKerberosTime
+{
+
+    /**
+     * Instantiates a new StoreRenewtill action.
+     */
+    public StoreRenewtill()
+    {
+        super( "Stores the renew-till" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setKerberosTime( KerberosTime krbtime, Asn1Container container )
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+        encTicketPartContainer.getEncTicketPart().setRenewtill( krbtime );
+        
+        container.setGrammarEndAllowed( true );
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreStartTime.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreStartTime.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreStartTime.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreStartTime.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.KerberosTime;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadKerberosTime;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+
+
+/**
+ * The action used to store the starttime KerberosTime
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreStartTime extends AbstractReadKerberosTime
+{
+
+    /**
+     * Instantiates a new StoreStartTime action.
+     */
+    public StoreStartTime()
+    {
+        super( "Stores the starttime" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setKerberosTime( KerberosTime krbtime, Asn1Container container )
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+        encTicketPartContainer.getEncTicketPart().setStartTime( krbtime );
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreTransited.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreTransited.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreTransited.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encTicketPart/actions/StoreTransited.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,105 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+
+package org.apache.directory.shared.kerberos.codec.encTicketPart.actions;
+
+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.encTicketPart.EncTicketPartContainer;
+import org.apache.directory.shared.kerberos.codec.transitedEncoding.TransitedEncodingContainer;
+import org.apache.directory.shared.kerberos.components.TransitedEncoding;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Store the transited value of EncTicketPart.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreTransited extends GrammarAction
+{
+    /** The logger */
+    private static final Logger LOG = LoggerFactory.getLogger( StoreTransited.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+    
+    /**
+     * Creates a new instance of StoreTransited.
+     */
+    public StoreTransited()
+    {
+        super( "EncTicketPart transited");
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void action( Asn1Container container ) throws DecoderException
+    {
+        EncTicketPartContainer encTicketPartContainer = ( EncTicketPartContainer ) container;
+        
+        TLV tlv = container.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 ) );
+        }
+
+        TransitedEncodingContainer transitedContainer = new TransitedEncodingContainer();
+
+        // Now, let's decode the TransitedEncoding
+        Asn1Decoder transitedEncodingDecoder = new Asn1Decoder();
+        
+        try
+        {
+            transitedEncodingDecoder.decode( container.getStream(), transitedContainer );
+        }
+        catch ( DecoderException de )
+        {
+            throw de;
+        }
+
+        TransitedEncoding te = transitedContainer.getTransitedEncoding();
+        
+        if ( IS_DEBUG )
+        {
+            LOG.debug( "TransitedEncoding {}", te );
+        }
+        
+        encTicketPartContainer.getEncTicketPart().setTransited( te );
+        
+        // Update the expected length for the current TLV
+        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
+
+        // Update the parent
+        container.updateParent();
+    }
+}

Added: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncTicketPartDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncTicketPartDecoderTest.java?rev=1039483&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncTicketPartDecoderTest.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncTicketPartDecoderTest.java Fri Nov 26 17:57:13 2010
@@ -0,0 +1,208 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+
+package org.apache.directory.shared.kerberos.codec;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.net.InetAddress;
+import java.nio.ByteBuffer;
+import java.util.Date;
+
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.kerberos.KerberosTime;
+import org.apache.directory.shared.kerberos.codec.encTicketPart.EncTicketPartContainer;
+import org.apache.directory.shared.kerberos.codec.types.AuthorizationType;
+import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
+import org.apache.directory.shared.kerberos.codec.types.PrincipalNameType;
+import org.apache.directory.shared.kerberos.codec.types.TransitedEncodingType;
+import org.apache.directory.shared.kerberos.components.AuthorizationData;
+import org.apache.directory.shared.kerberos.components.EncTicketPart;
+import org.apache.directory.shared.kerberos.components.EncryptionKey;
+import org.apache.directory.shared.kerberos.components.HostAddress;
+import org.apache.directory.shared.kerberos.components.HostAddresses;
+import org.apache.directory.shared.kerberos.components.PrincipalName;
+import org.apache.directory.shared.kerberos.components.TransitedEncoding;
+import org.apache.directory.shared.kerberos.flags.TicketFlag;
+import org.apache.directory.shared.kerberos.flags.TicketFlags;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * Test cases for EncTicketPart codec
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EncTicketPartDecoderTest
+{
+
+    private EncTicketPart expected;
+
+
+    @Before
+    public void setup() throws Exception
+    {
+        TicketFlags flags = new TicketFlags( TicketFlag.FORWARDABLE.getValue() );
+
+        EncryptionKey key = new EncryptionKey( EncryptionType.DES3_CBC_MD5, new byte[]
+            { 0, 1 } );
+
+        String cRealm = "crealm";
+
+        PrincipalName cName = new PrincipalName( "cname", PrincipalNameType.KRB_NT_PRINCIPAL );
+
+        TransitedEncoding transited = new TransitedEncoding();
+        transited.setContents( new byte[]
+            { 0, 1 } );
+        transited.setTrType( TransitedEncodingType.DOMAIN_X500_COMPRESS );
+
+        long time = new Date().getTime();
+
+        KerberosTime authTime = new KerberosTime( time );
+
+        KerberosTime startTime = new KerberosTime( time );
+
+        KerberosTime endTime = new KerberosTime( time );
+
+        KerberosTime renewtill = new KerberosTime( time );
+
+        HostAddresses caddr = new HostAddresses( new HostAddress[]
+            { new HostAddress( InetAddress.getByName( "localhost" ) ) } );
+
+        AuthorizationData authzData = new AuthorizationData();
+        authzData.createNewAD();
+        authzData.setCurrentAdType( AuthorizationType.AD_IF_RELEVANT );
+        authzData.setCurrentAdData( new byte[]
+            { 0, 1 } );
+
+        expected = new EncTicketPart();
+        expected.setFlags( flags );
+        expected.setKey( key );
+        expected.setcRealm( cRealm );
+        expected.setcName( cName );
+        expected.setTransited( transited );
+        expected.setAuthTime( authTime );
+        expected.setStartTime( startTime );
+        expected.setEndTime( endTime );
+        expected.setRenewtill( renewtill );
+        expected.setClientAddresses( caddr );
+        expected.setAuthorizationData( authzData );
+    }
+
+
+    @Test
+    public void testDecodeEncTicketPart() throws Exception
+    {
+        encodeDecodeAndTest( expected );
+    }
+
+
+    @Test
+    public void testDecodeEncTicketPartWithoutStartAndRenewtillTimes() throws Exception
+    {
+        expected.setStartTime( null );
+        expected.setRenewtill( null );
+
+        encodeDecodeAndTest( expected );
+    }
+
+
+    @Test
+    public void testDecodeEncTicketPartWithoutRenwtillTime() throws Exception
+    {
+        expected.setRenewtill( null );
+
+        encodeDecodeAndTest( expected );
+    }
+
+
+    @Test
+    public void testDecodeEncTicketPartWithoutRenwtillAndClientAddresses() throws Exception
+    {
+        expected.setRenewtill( null );
+        expected.setClientAddresses( null );
+
+        encodeDecodeAndTest( expected );
+    }
+
+
+    @Test
+    public void testDecodeEncTicketPartWithoutOptionalElements() throws Exception
+    {
+        expected.setStartTime( null );
+        expected.setRenewtill( null );
+        expected.setClientAddresses( null );
+        expected.setAuthorizationData( null );
+
+        encodeDecodeAndTest( expected );
+    }
+
+
+    private void encodeDecodeAndTest( EncTicketPart expected )
+    {
+        int expectedLen = expected.computeLength();
+
+        ByteBuffer stream = ByteBuffer.allocate( expectedLen );
+
+        try
+        {
+            expected.encode( stream );
+        }
+        catch ( EncoderException e )
+        {
+            fail();
+        }
+
+        stream.flip();
+
+        Asn1Decoder decoder = new Asn1Decoder();
+        EncTicketPartContainer container = new EncTicketPartContainer();
+        container.setStream( stream );
+
+        try
+        {
+            decoder.decode( stream, container );
+        }
+        catch ( DecoderException e )
+        {
+            fail();
+        }
+
+        EncTicketPart actual = container.getEncTicketPart();
+
+        assertEquals( expected.getFlags(), actual.getFlags() );
+        assertEquals( expected.getKey(), actual.getKey() );
+        assertEquals( expected.getcRealm(), actual.getcRealm() );
+        assertEquals( expected.getcName(), actual.getcName() );
+        assertEquals( expected.getTransited(), actual.getTransited() );
+        assertEquals( expected.getAuthTime(), actual.getAuthTime() );
+        assertEquals( expected.getStartTime(), actual.getStartTime() );
+        assertEquals( expected.getEndTime(), actual.getEndTime() );
+        assertEquals( expected.getRenewtill(), actual.getRenewtill() );
+        assertEquals( expected.getClientAddresses(), actual.getClientAddresses() );
+        assertEquals( expected.getAuthorizationData(), actual.getAuthorizationData() );
+    }
+
+}



Mime
View raw message