You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/11/27 02:53:40 UTC
svn commit: r1039593 - in
/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos:
codec/adKdcIssued/ codec/adKdcIssued/actions/ components/
Author: elecharny
Date: Sat Nov 27 01:53:39 2010
New Revision: 1039593
URL: http://svn.apache.org/viewvc?rev=1039593&view=rev
Log:
Added the AdKDCIssued grammar
Added:
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKDCIssuedGrammar.java
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKDCIssuedStatesEnum.java
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKdcIssuedContainer.java
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/AdKdcIssuedInit.java
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreChecksum.java
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreElements.java
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreIRealm.java
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreISName.java
Modified:
directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AdKdcIssued.java
Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKDCIssuedGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKDCIssuedGrammar.java?rev=1039593&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKDCIssuedGrammar.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKDCIssuedGrammar.java Sat Nov 27 01:53:39 2010
@@ -0,0 +1,121 @@
+/*
+ * 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.adKdcIssued;
+
+
+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.adKdcIssued.actions.AdKdcIssuedInit;
+import org.apache.directory.shared.kerberos.codec.adKdcIssued.actions.StoreChecksum;
+import org.apache.directory.shared.kerberos.codec.adKdcIssued.actions.StoreElements;
+import org.apache.directory.shared.kerberos.codec.adKdcIssued.actions.StoreIRealm;
+import org.apache.directory.shared.kerberos.codec.adKdcIssued.actions.StoreISName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class implements the AdKdcIssued 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 AdKDCIssuedGrammar extends AbstractGrammar
+{
+ /** The logger */
+ static final Logger LOG = LoggerFactory.getLogger( AdKDCIssuedGrammar.class );
+
+ /** A speedup for logger */
+ static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+ /** The instance of grammar. AdKdcIssuedGrammar is a singleton */
+ private static Grammar instance = new AdKDCIssuedGrammar();
+
+
+ /**
+ * Creates a new AdKdcIssuedGrammar object.
+ */
+ private AdKDCIssuedGrammar()
+ {
+ setName( AdKDCIssuedGrammar.class.getName() );
+
+ // Create the transitions table
+ super.transitions = new GrammarTransition[AdKDCIssuedStatesEnum.LAST_AD_KDC_ISSUED_STATE.ordinal()][256];
+
+ // ============================================================================================
+ // AdKdcIssued
+ // ============================================================================================
+ // --------------------------------------------------------------------------------------------
+ // Transition from AdKdcIssued init to SEQ
+ // --------------------------------------------------------------------------------------------
+ // AD-KDCIssued ::= SEQUENCE {
+ super.transitions[AdKDCIssuedStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
+ AdKDCIssuedStatesEnum.START_STATE, AdKDCIssuedStatesEnum.AD_KDC_ISSUED_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
+ new AdKdcIssuedInit() );
+
+ super.transitions[AdKDCIssuedStatesEnum.AD_KDC_ISSUED_SEQ_STATE.ordinal()][KerberosConstants.AD_KDC_ISSUED_AD_CHECKSUM_TAG] = new GrammarTransition(
+ AdKDCIssuedStatesEnum.AD_KDC_ISSUED_SEQ_STATE, AdKDCIssuedStatesEnum.AD_KDC_ISSUED_AD_CHECKSUM_TAG_STATE, KerberosConstants.AD_KDC_ISSUED_AD_CHECKSUM_TAG,
+ new StoreChecksum() );
+
+ super.transitions[AdKDCIssuedStatesEnum.AD_KDC_ISSUED_AD_CHECKSUM_TAG_STATE.ordinal()][KerberosConstants.AD_KDC_ISSUED_I_REALM_TAG] = new GrammarTransition(
+ AdKDCIssuedStatesEnum.AD_KDC_ISSUED_AD_CHECKSUM_TAG_STATE, AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_REALM_TAG_STATE, KerberosConstants.AD_KDC_ISSUED_I_REALM_TAG,
+ new CheckNotNullLength() );
+
+ super.transitions[AdKDCIssuedStatesEnum.AD_KDC_ISSUED_AD_CHECKSUM_TAG_STATE.ordinal()][KerberosConstants.AD_KDC_ISSUED_I_SNAME_TAG] = new GrammarTransition(
+ AdKDCIssuedStatesEnum.AD_KDC_ISSUED_AD_CHECKSUM_TAG_STATE, AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_SNAME_TAG_STATE, KerberosConstants.AD_KDC_ISSUED_I_SNAME_TAG,
+ new StoreISName() );
+
+ super.transitions[AdKDCIssuedStatesEnum.AD_KDC_ISSUED_AD_CHECKSUM_TAG_STATE.ordinal()][KerberosConstants.AD_KDC_ISSUED_ELEMENTS_TAG] = new GrammarTransition(
+ AdKDCIssuedStatesEnum.AD_KDC_ISSUED_AD_CHECKSUM_TAG_STATE, AdKDCIssuedStatesEnum.AD_KDC_ISSUED_ELEMENTS_TAG_STATE, KerberosConstants.AD_KDC_ISSUED_ELEMENTS_TAG,
+ new StoreElements() );
+
+ super.transitions[AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_REALM_TAG_STATE.ordinal()][UniversalTag.GENERAL_STRING.getValue()] = new GrammarTransition(
+ AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_REALM_TAG_STATE, AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_REALM_STATE, UniversalTag.GENERAL_STRING.getValue(),
+ new StoreIRealm() );
+
+ super.transitions[AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_REALM_STATE.ordinal()][KerberosConstants.AD_KDC_ISSUED_I_SNAME_TAG] = new GrammarTransition(
+ AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_REALM_STATE, AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_SNAME_TAG_STATE, KerberosConstants.AD_KDC_ISSUED_I_SNAME_TAG,
+ new StoreISName() );
+
+ super.transitions[AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_REALM_STATE.ordinal()][KerberosConstants.AD_KDC_ISSUED_ELEMENTS_TAG] = new GrammarTransition(
+ AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_REALM_STATE, AdKDCIssuedStatesEnum.AD_KDC_ISSUED_ELEMENTS_TAG_STATE, KerberosConstants.AD_KDC_ISSUED_ELEMENTS_TAG,
+ new StoreElements() );
+
+ super.transitions[AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_SNAME_TAG_STATE.ordinal()][KerberosConstants.AD_KDC_ISSUED_ELEMENTS_TAG] = new GrammarTransition(
+ AdKDCIssuedStatesEnum.AD_KDC_ISSUED_I_SNAME_TAG_STATE, AdKDCIssuedStatesEnum.AD_KDC_ISSUED_ELEMENTS_TAG_STATE, KerberosConstants.AD_KDC_ISSUED_ELEMENTS_TAG,
+ new StoreElements() );
+ }
+
+
+ /**
+ * Get the instance of this grammar
+ *
+ * @return An instance on the AdKdcIssued Grammar
+ */
+ public static Grammar getInstance()
+ {
+ return instance;
+ }
+}
Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKDCIssuedStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKDCIssuedStatesEnum.java?rev=1039593&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKDCIssuedStatesEnum.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKDCIssuedStatesEnum.java Sat Nov 27 01:53:39 2010
@@ -0,0 +1,114 @@
+/*
+ * 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.adKdcIssued;
+
+
+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 AdKDCIssued grammar's constants. It is also used for debugging
+ * purpose
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public enum AdKDCIssuedStatesEnum implements States
+{
+ // Start
+ START_STATE, // 0
+
+ // ----- AdKDCIssued message --------------------------------------
+ AD_KDC_ISSUED_SEQ_STATE, // 1
+
+ AD_KDC_ISSUED_AD_CHECKSUM_TAG_STATE, // 2
+
+ AD_KDC_ISSUED_I_REALM_TAG_STATE, // 3
+ AD_KDC_ISSUED_I_REALM_STATE, // 4
+
+ AD_KDC_ISSUED_I_SNAME_TAG_STATE, // 5
+
+ AD_KDC_ISSUED_ELEMENTS_TAG_STATE, // 6
+
+ // End
+ LAST_AD_KDC_ISSUED_STATE; // 7
+
+
+ /**
+ * Get the grammar name
+ *
+ * @param grammar The grammar code
+ * @return The grammar name
+ */
+ public String getGrammarName( int grammar )
+ {
+ return "AD_KDC_ISSUED_GRAMMAR";
+ }
+
+
+ /**
+ * Get the grammar name
+ *
+ * @param grammar The grammar class
+ * @return The grammar name
+ */
+ public String getGrammarName( Grammar grammar )
+ {
+ if ( grammar instanceof KerberosMessageGrammar )
+ {
+ return "AD_KDC_ISSUED_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_AD_KDC_ISSUED_STATE.ordinal() ) ? "AD_KDC_ISSUED_END_STATE" : name() );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isEndState()
+ {
+ return this == LAST_AD_KDC_ISSUED_STATE;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public AdKDCIssuedStatesEnum getStartState()
+ {
+ return START_STATE;
+ }
+}
Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKdcIssuedContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKdcIssuedContainer.java?rev=1039593&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKdcIssuedContainer.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/AdKdcIssuedContainer.java Sat Nov 27 01:53:39 2010
@@ -0,0 +1,67 @@
+/*
+ * 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.adKdcIssued;
+
+import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
+import org.apache.directory.shared.kerberos.components.AdKdcIssued;
+
+
+/**
+ * The AdKdcIssued container stores the AdKdcIssued decoded by the Asn1Decoder.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AdKdcIssuedContainer extends KdcReqContainer
+{
+ /** An AdKdcIssued container */
+ private AdKdcIssued adKdcIssued = new AdKdcIssued();
+
+ /**
+ * Creates a new AdKdcIssuedContainer object.
+ */
+ public AdKdcIssuedContainer()
+ {
+ super();
+ this.stateStack = new int[1];
+ this.grammar = AdKDCIssuedGrammar.getInstance();
+ setTransition( AdKDCIssuedStatesEnum.START_STATE );
+ }
+
+
+ /**
+ * @return Returns the AdKdcIssued.
+ */
+ public AdKdcIssued getAdKdcIssued()
+ {
+ return adKdcIssued;
+ }
+
+
+ /**
+ * Set an AdKdcIssued Object into the container. It will be completed by the
+ * KerberosDecoder.
+ *
+ * @param adKdcIssued The AdKdcIssued to set.
+ */
+ public void setAdKdcIssued( AdKdcIssued adKdcIssued )
+ {
+ this.adKdcIssued = adKdcIssued;
+ }
+}
Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/AdKdcIssuedInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/AdKdcIssuedInit.java?rev=1039593&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/AdKdcIssuedInit.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/AdKdcIssuedInit.java Sat Nov 27 01:53:39 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.adKdcIssued.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.adKdcIssued.AdKdcIssuedContainer;
+import org.apache.directory.shared.kerberos.components.AdKdcIssued;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the AD-KDCIssued object
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AdKdcIssuedInit extends GrammarAction
+{
+ /** The logger */
+ private static final Logger LOG = LoggerFactory.getLogger( AdKdcIssuedInit.class );
+
+ /** Speedup for logs */
+ private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+
+ /**
+ * Instantiates a new AdKdcIssuedInit action.
+ */
+ public AdKdcIssuedInit()
+ {
+ super( "Creates a AD-KDCIssued instance" );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void action( Asn1Container container ) throws DecoderException
+ {
+ AdKdcIssuedContainer adKdcIssuedContainer = ( AdKdcIssuedContainer ) container;
+
+ TLV tlv = adKdcIssuedContainer.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 ) );
+ }
+
+ AdKdcIssued adKdcIssued = new AdKdcIssued();
+ adKdcIssuedContainer.setAdKdcIssued( adKdcIssued );
+
+ if ( IS_DEBUG )
+ {
+ LOG.debug( "AdKdcIssued created" );
+ }
+ }
+}
Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreChecksum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreChecksum.java?rev=1039593&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreChecksum.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreChecksum.java Sat Nov 27 01:53:39 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.adKdcIssued.actions;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadCheckSum;
+import org.apache.directory.shared.kerberos.codec.adKdcIssued.AdKdcIssuedContainer;
+import org.apache.directory.shared.kerberos.components.Checksum;
+
+
+/**
+ * The action used to set the AD-KDCIssued cksum
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreChecksum extends AbstractReadCheckSum
+{
+
+ /**
+ * Instantiates a new StoreChecksum action.
+ */
+ public StoreChecksum()
+ {
+ super( "AD-KDCIssued cksum" );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setChecksum( Checksum checksum, Asn1Container container )
+ {
+ AdKdcIssuedContainer adKdcIssuedContainer = ( AdKdcIssuedContainer ) container;
+ adKdcIssuedContainer.getAdKdcIssued().setAdChecksum( checksum );
+ }
+}
Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreElements.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreElements.java?rev=1039593&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreElements.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreElements.java Sat Nov 27 01:53:39 2010
@@ -0,0 +1,111 @@
+/*
+ * 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.adKdcIssued.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.adKdcIssued.AdKdcIssuedContainer;
+import org.apache.directory.shared.kerberos.codec.authorizationData.AuthorizationDataContainer;
+import org.apache.directory.shared.kerberos.components.AuthorizationData;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to store the AD-KDCIssued 'elements' value
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreElements extends GrammarAction
+{
+ /** The logger */
+ private static final Logger LOG = LoggerFactory.getLogger( StoreElements.class );
+
+ /** Speedup for logs */
+ private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+
+ /**
+ * Instantiates a new StoreElements action.
+ */
+ public StoreElements()
+ {
+ super( "AdKdcIssued 'elements' value" );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void action( Asn1Container container ) throws DecoderException
+ {
+ AdKdcIssuedContainer adKdcIssuedContainer = ( AdKdcIssuedContainer ) container;
+
+ TLV tlv = adKdcIssuedContainer.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 AuthorizationData
+ Asn1Decoder authorizationDataDecoder = new Asn1Decoder();
+
+ AuthorizationDataContainer authorizationDataContainer = new AuthorizationDataContainer();
+ authorizationDataContainer.setStream( container.getStream() );
+
+ // Decode the AuthorizationData PDU
+ try
+ {
+ authorizationDataDecoder.decode( container.getStream(), authorizationDataContainer );
+ }
+ catch ( DecoderException de )
+ {
+ throw de;
+ }
+
+ // Update the expected length for the current TLV
+ tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
+
+ // Update the parent
+ container.updateParent();
+
+ // Store the AuthorizationData in the container
+ AuthorizationData elements = authorizationDataContainer.getAuthorizationData();
+ adKdcIssuedContainer.getAdKdcIssued().setElements( elements );
+
+
+ if ( IS_DEBUG )
+ {
+ LOG.debug( "Elements added : {}", elements );
+ }
+
+ container.setGrammarEndAllowed( true );
+ }
+}
Added: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreIRealm.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreIRealm.java?rev=1039593&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreIRealm.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreIRealm.java Sat Nov 27 01:53:39 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.adKdcIssued.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.adKdcIssued.AdKdcIssuedContainer;
+
+
+/**
+ * The action used to set the i-realm
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreIRealm extends AbstractReadRealm
+{
+
+ /**
+ * Instantiates a new StoreIRealm action.
+ */
+ public StoreIRealm()
+ {
+ super( "Authenticator i-realm value" );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setRealm( String realm, Asn1Container container )
+ {
+ AdKdcIssuedContainer adKdcIssuedContainer = ( AdKdcIssuedContainer ) container;
+ adKdcIssuedContainer.getAdKdcIssued().setIRealm( realm );
+ }
+}
Added: 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=1039593&view=auto
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreISName.java (added)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreISName.java Sat Nov 27 01:53:39 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.adKdcIssued.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.adKdcIssued.AdKdcIssuedContainer;
+import org.apache.directory.shared.kerberos.components.PrincipalName;
+
+
+/**
+ * The action used to set the AD-KDCIssued i-sName
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreISName extends AbstractReadPrincipalName
+{
+
+ /**
+ * Instantiates a new StoreISName action.
+ */
+ public StoreISName()
+ {
+ super( "AD-KDCIssued i-sname" );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setPrincipalName( PrincipalName principalName, Asn1Container container )
+ {
+ AdKdcIssuedContainer adKdcIssuedContainer = ( AdKdcIssuedContainer ) container;
+ adKdcIssuedContainer.getAdKdcIssued().setISName( principalName );
+ }
+}
Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AdKdcIssued.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AdKdcIssued.java?rev=1039593&r1=1039592&r2=1039593&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AdKdcIssued.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AdKdcIssued.java Sat Nov 27 01:53:39 2010
@@ -124,7 +124,7 @@ public class AdKdcIssued extends Abstrac
/**
* @return the irealm
*/
- public String getIrealm()
+ public String getIRealm()
{
return irealm;
}
@@ -133,7 +133,7 @@ public class AdKdcIssued extends Abstrac
/**
* @param irealm the irealm to set
*/
- public void setIrealm( String irealm )
+ public void setIRealm( String irealm )
{
this.irealm = irealm;
}
@@ -142,7 +142,7 @@ public class AdKdcIssued extends Abstrac
/**
* @return the isname
*/
- public PrincipalName getIsname()
+ public PrincipalName getISName()
{
return isname;
}
@@ -151,7 +151,7 @@ public class AdKdcIssued extends Abstrac
/**
* @param isname the isname to set
*/
- public void setIsname( PrincipalName isname )
+ public void setISName( PrincipalName isname )
{
this.isname = isname;
}
@@ -255,7 +255,7 @@ public class AdKdcIssued extends Abstrac
}
// the elements
- buffer.put( ( byte ) KerberosConstants.AD_AND_OR_ELEMENTS_TAG );
+ buffer.put( ( byte ) KerberosConstants.AD_KDC_ISSUED_ELEMENTS_TAG );
buffer.put( (byte)elementsTagLength );
elements.encode( buffer );
}