directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r578743 [7/12] - in /directory/apacheds/branches/apacheds-kerberos: kerberos-shared/ kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/ kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto...
Date Mon, 24 Sep 2007 10:18:45 GMT
Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KdcOption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KdcOption.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KdcOption.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KdcOption.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,177 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.flags;
+
+/**
+ * An enum to describe all the KdcOption possible values.
+ *  
+ *  KDCOptions      ::= KerberosFlags
+ *           -- reserved(0),
+ *           -- forwardable(1),
+ *           -- forwarded(2),
+ *           -- proxiable(3),
+ *           -- proxy(4),
+ *           -- allow-postdate(5),
+ *           -- postdated(6),
+ *           -- unused7(7),
+ *           -- renewable(8),
+ *           -- unused9(9),
+ *           -- unused10(10),
+ *           -- opt-hardware-auth(11),
+ *           -- unused12(12),
+ *           -- unused13(13),
+ *           -- 15 is reserved for canonicalize
+ *           -- unused15(15),
+ *           -- 26 was unused in 1510
+ *           -- disable-transited-check(26),
+ *           -- renewable-ok(27),
+ *           -- enc-tkt-in-skey(28),
+ *           -- renew(30),
+ *           -- validate(31)
+
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public enum KdcOption implements KerberosFlag
+{
+    /**
+     * KDC option - reserved.
+     */
+    RESERVED(0),
+    /**
+     * KDC option - forwardable.
+     */
+    FORWARDABLE(1),
+
+    /**
+     * KDC option - forwarded.
+     */
+    FORWARDED(2),
+
+    /**
+     * KDC option - proxiable.
+     */
+    PROXIABLE(3),
+
+    /**
+     * KDC option - proxy.
+     */
+    PROXY(4),
+
+    /**
+     * KDC option - allow postdate.
+     */
+    ALLOW_POSTDATE(5),
+
+    /**
+     * KDC option - postdated.
+     */
+    POSTDATED(6),
+
+    /**
+     * KDC option - unused7.
+     */
+    UNUSED7(7),
+
+    /**
+     * KDC option - renewable.
+     */
+    RENEWABLE(8),
+
+    /**
+     * KDC option - unused9.
+     */
+    UNUSED9(9),
+
+    /**
+     * KDC option - unused10.
+     */
+    UNUSED10(10),
+
+    /**
+     * KDC option - unused11.
+     */
+    OPT_HARDWARE_AUTH(11),
+
+    /**
+     * KDC option - unused12.
+     */
+    UNUSED12(12),
+
+    /**
+     * KDC option - unused13.
+     */
+    UNUSED13(13),
+
+    /**
+     * KDC option - unused15.
+     */
+    UNUSED15(15),
+
+    /**
+     * KDC option - disable transisted checked.
+     */
+    DISABLE_TRANSISTED_CHECKED(26),
+
+    /**
+     * KDC option - renewable is ok.
+     */
+    RENEWABLE_OK(27),
+
+    /**
+     * KDC option - encrypted key in skey.
+     */
+    ENC_TKT_IN_SKEY(28),
+
+    /**
+     * KDC option - renew.
+     */
+    RENEW(30),
+
+    /**
+     * KDC option - validate.
+     */
+    VALIDATE(31),
+
+    /**
+     * KDC option - maximum value.
+     */
+    MAX_VALUE(32);
+
+    // The interned value.
+    private int value;
+    
+    /**
+     * Class constructor
+     */
+    private KdcOption( int value )
+    {
+        this.value = value;
+    }
+    
+    /**
+     * @return The ordinal value associated with this flag
+     */
+    public int getOrdinal()
+    {
+        return value;
+    }
+}

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KdcOptions.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KdcOptions.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KdcOptions.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KdcOptions.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,189 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.flags;
+
+/**
+ * The KDCOptions class. The ASN.1 grammar is :
+ * 
+ *  KDCOptions      ::= KerberosFlags
+ *           -- reserved(0),
+ *           -- forwardable(1),
+ *           -- forwarded(2),
+ *           -- proxiable(3),
+ *           -- proxy(4),
+ *           -- allow-postdate(5),
+ *           -- postdated(6),
+ *           -- unused7(7),
+ *           -- renewable(8),
+ *           -- unused9(9),
+ *           -- unused10(10),
+ *           -- opt-hardware-auth(11),
+ *           -- unused12(12),
+ *           -- unused13(13),
+ *           -- 15 is reserved for canonicalize
+ *           -- unused15(15),
+ *           -- 26 was unused in 1510
+ *           -- disable-transited-check(26),
+ *           -- renewable-ok(27),
+ *           -- enc-tkt-in-skey(28),
+ *           -- renew(30),
+ *           -- validate(31)
+ *           
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public class KdcOptions extends AbstractKerberosFlags
+{
+    public static final long serialVersionUID = 1L;
+    
+    /**
+     * Basic constructor of a KdcOptions BitString
+     */
+    public KdcOptions()
+    {
+        super();
+    }
+    
+    /**
+     * Constructor of a KdcOptions BitString with an int value
+     */
+    public KdcOptions( int flags )
+    {
+        super( getBytes( flags ) );
+    }
+    
+    /**
+     * Basic constructor of a KdcOptions BitString with a byte array
+     */
+    public KdcOptions( byte[] flags )
+    {
+        super( flags );
+    }
+    
+    /**
+     * Converts the object to a printable string.
+     */
+    public String toString()
+    {
+        StringBuilder result = new StringBuilder();
+
+        if ( isFlagSet( KdcOption.RESERVED ) )
+        {
+            result.append( "RESERVED(0) " );
+        }
+
+        if ( isFlagSet( KdcOption.FORWARDABLE ) )
+        {
+            result.append( "FORWARDABLE(1) " );
+        }
+
+        if ( isFlagSet( KdcOption.FORWARDED ) )
+        {
+            result.append( "FORWARDED(2) " );
+        }
+        
+        if ( isFlagSet( KdcOption.PROXIABLE ) )
+        {
+            result.append( "PROXIABLE(3) " );
+        }
+
+        if ( isFlagSet( KdcOption.PROXY ) )
+        {
+            result.append( "PROXY(4) " );
+        }
+
+        if ( isFlagSet( KdcOption.ALLOW_POSTDATE ) )
+        {
+            result.append( "ALLOW_POSTDATE(5) " );
+        }
+
+        if ( isFlagSet( KdcOption.POSTDATED ) )
+        {
+            result.append( "POSTDATED(6) " );
+        }
+
+        if ( isFlagSet( KdcOption.UNUSED7 ) )
+        {
+            result.append( "UNUSED(7) " );
+        }
+
+        if ( isFlagSet( KdcOption.RENEWABLE ) )
+        {
+            result.append( "RENEWABLE(8) " );
+        }
+
+        if ( isFlagSet( KdcOption.UNUSED9 ) )
+        {
+            result.append( "UNUSED(9) " );
+        }
+
+        if ( isFlagSet( KdcOption.UNUSED10 ) )
+        {
+            result.append( "UNUSED(10) " );
+        }
+
+        if ( isFlagSet( KdcOption.OPT_HARDWARE_AUTH ) )
+        {
+            result.append( "OPT_HARDWARE_AUTH(11) " );
+        }
+
+        if ( isFlagSet( KdcOption.UNUSED12 ) )
+        {
+            result.append( "UNUSED(12) " );
+        }
+
+        if ( isFlagSet( KdcOption.UNUSED13 ) )
+        {
+            result.append( "UNUSED(13) " );
+        }
+
+        if ( isFlagSet( KdcOption.UNUSED15 ) )
+        {
+            result.append( "UNUSED(15) " );
+        }
+
+        if ( isFlagSet( KdcOption.DISABLE_TRANSISTED_CHECKED ) )
+        {
+            result.append( "DISABLE_TRANSISTED_CHECKED(26) " );
+        }
+
+        if ( isFlagSet( KdcOption.RENEWABLE_OK ) )
+        {
+            result.append( "RENEWABLE_OK(27) " );
+        }
+
+        if ( isFlagSet( KdcOption.ENC_TKT_IN_SKEY ) )
+        {
+            result.append( "ENC_TKT_IN_SKEY(28) " );
+        }
+
+        if ( isFlagSet( KdcOption.RENEW ) )
+        {
+            result.append( "RENEW(30) " );
+        }
+
+        if ( isFlagSet( KdcOption.VALIDATE ) )
+        {
+            result.append( "VALIDATE(31) " );
+        }
+        
+        return result.toString().trim();
+    }
+}

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KerberosFlag.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KerberosFlag.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KerberosFlag.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KerberosFlag.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.flags;
+
+/**
+ * This interface must be implemented by all the inherited Flag classes :
+ * - TicketFlag
+ * - ApOption
+ * - KdcOption
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ *
+ */
+public interface KerberosFlag
+{
+    public int getOrdinal();
+}

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KerberosFlags.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KerberosFlags.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KerberosFlags.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/KerberosFlags.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.flags;
+
+/**
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ *
+ */
+public interface KerberosFlags
+{
+    public byte[] getBytes();
+    public int getIntValue();
+    public boolean isFlagSet( KerberosFlag flag );
+    public boolean isFlagSet( int flag );
+    public void setFlag( KerberosFlag flag );
+    public void setFlag( int flag );
+    public void clearFlag( KerberosFlag flag );
+    public void clearFlag( int flag );
+}

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/Options.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/Options.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/Options.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/Options.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,128 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.flags;
+
+
+import java.util.BitSet;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public abstract class Options
+{
+    private BitSet options;
+    private int maxSize;
+
+
+    protected Options( int maxSize )
+    {
+        this.maxSize = maxSize;
+        options = new BitSet( maxSize );
+    }
+
+
+    /**
+     * Returns whether the option at a given index matches the option in this {@link Options}.
+     *
+     * @param options
+     * @param option
+     * @return true if two options are the same.
+     */
+    public boolean match( Options options, int option )
+    {
+        return options.get( option ) == this.get( option );
+    }
+
+
+    /**
+     * Returns the value of the option at the given index.
+     *
+     * @param index
+     * @return true if the option at the given index is set.
+     */
+    public boolean get( int index )
+    {
+        return options.get( index );
+    }
+
+
+    /**
+     * Sets the option at a given index.
+     *
+     * @param index
+     */
+    public void set( int index )
+    {
+        options.set( index );
+    }
+
+
+    /**
+     * Clears (sets false) the option at a given index.
+     *
+     * @param index
+     */
+    public void clear( int index )
+    {
+        options.clear( index );
+    }
+
+
+    /**
+     * Byte-reversing methods are an anomaly of the BouncyCastle
+     * DERBitString endianness.  Thes methods can be removed if the
+     * Apache Directory Snickers codecs operate differently.
+     * 
+     * @return The raw {@link Options} bytes.
+     */
+    public byte[] getBytes()
+    {
+        byte[] bytes = new byte[maxSize / 8];
+
+        for ( int ii = 0; ii < maxSize; ii++ )
+        {
+            if ( options.get( reversePosition( ii ) ) )
+            {
+                bytes[bytes.length - ii / 8 - 1] |= 1 << ( ii % 8 );
+            }
+        }
+        return bytes;
+    }
+
+
+    protected void setBytes( byte[] bytes )
+    {
+        for ( int ii = 0; ii < bytes.length * 8; ii++ )
+        {
+            if ( ( bytes[bytes.length - ii / 8 - 1] & ( 1 << ( ii % 8 ) ) ) > 0 )
+            {
+                options.set( reversePosition( ii ) );
+            }
+        }
+    }
+
+
+    private int reversePosition( int position )
+    {
+        return maxSize - 1 - position;
+    }
+}

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/TicketFlag.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/TicketFlag.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/TicketFlag.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/TicketFlag.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,139 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.flags;
+
+/**
+ * An enum to describe all the TicketFlag possible values.
+ * 
+ *  TicketFlags     ::= KerberosFlags
+ *           -- reserved(0),
+ *           -- forwardable(1),
+ *           -- forwarded(2),
+ *           -- proxiable(3),
+ *           -- proxy(4),
+ *           -- may-postdate(5),
+ *           -- postdated(6),
+ *           -- invalid(7),
+ *           -- renewable(8),
+ *           -- initial(9),
+ *           -- pre-authent(10),
+ *           -- hw-authent(11),
+ *       -- the following are new since 1510
+ *           -- transited-policy-checked(12),
+ *           -- ok-as-delegate(13)
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public enum TicketFlag implements KerberosFlag
+{
+    /**
+     * Ticket flag - reserved
+     */
+    RESERVED(0),
+
+    /**
+     * Ticket flag - forwardable
+     */
+    FORWARDABLE(1),
+
+    /**
+     * Ticket flag - forwarded
+     */
+    FORWARDED(2),
+
+    /**
+     * Ticket flag - proxiable
+     */
+    PROXIABLE(3),
+
+    /**
+     * Ticket flag - proxy
+     */
+    PROXY(4),
+
+    /**
+     * Ticket flag - may be postdated
+     */
+    MAY_POSTDATE(5),
+
+    /**
+     * Ticket flag - postdated
+     */
+    POSTDATED(6),
+    /**
+     * Ticket flag - invalid
+     */
+    INVALID(7),
+
+    /**
+     * Ticket flag - renewable
+     */
+    RENEWABLE(8),
+
+    /**
+     * Ticket flag - initial
+     */
+    INITIAL(9),
+
+    /**
+     * Ticket flag - pre-authentication
+     */
+    PRE_AUTHENT(10),
+
+    /**
+     * Ticket flag - hardware authentication
+     */
+    HW_AUTHENT(11),
+
+    /**
+     * Ticket flag - transitedEncoding policy checked
+     */
+    TRANSITED_POLICY_CHECKED(12),
+
+    /**
+     * Ticket flag - OK as delegate
+     */
+    OK_AS_DELEGATE(13),
+
+    /**
+     * Ticket flag - maximum value
+     */
+    MAX_VALUE(32);
+
+    // The interned value.
+    private int value;
+    
+    /**
+     * Class constructor
+     */
+    private TicketFlag( int value )
+    {
+        this.value = value;
+    }
+    
+    /**
+     * @return The ordinal value associated with this flag
+     */
+    public int getOrdinal()
+    {
+        return value;
+    }
+}

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/TicketFlags.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/TicketFlags.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/TicketFlags.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/TicketFlags.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,329 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.flags;
+
+
+/**
+ * An implementation of a BitString for the TicketFlags. The different values
+ * are stored in an int, as there can't be more than 32 flags (TicketFlag).
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public class TicketFlags extends AbstractKerberosFlags
+{
+    public static final long serialVersionUID = 1L;
+
+   /**
+     * Basic constructor of a TicketFlags BitString
+     */
+    public TicketFlags()
+    {
+        super();
+    }
+    
+    /**
+     * Constructor of a TicketFlags BitString with an int value
+     */
+    public TicketFlags( int flags )
+    {
+        super( getBytes( flags ) );
+    }
+    
+    /**
+     * Basic constructor of a TicketFlags BitString with a byte array
+     */
+    public TicketFlags( byte[] flags )
+    {
+        super( flags );
+    }
+    
+    /**
+     * Ticket flag - reserved
+     */
+    public boolean isReserved()
+    {
+    	return isFlagSet( TicketFlag.RESERVED );
+    }
+
+    /**
+     * Ticket flag - forwardable
+     */
+    public boolean isForwardable()
+    {
+    	return isFlagSet( TicketFlag.FORWARDABLE );
+    }
+
+    /**
+     * Ticket flag - forwarded
+     */
+    public boolean isForwarded()
+    {
+    	return isFlagSet( TicketFlag.FORWARDED );
+    }
+
+    /**
+     * Ticket flag - proxiable
+     */
+    public boolean isProxiable()
+    {
+    	return isFlagSet( TicketFlag.PROXIABLE );
+    }
+
+    /**
+     * Ticket flag - proxy
+     */
+    public boolean isProxy()
+    {
+    	return isFlagSet( TicketFlag.PROXY );
+    }
+
+    /**
+     * Ticket flag - may be postdated
+     */
+    public boolean isMayPosdate()
+    {
+    	return isFlagSet( TicketFlag.MAY_POSTDATE );
+    }
+
+    /**
+     * Ticket flag - postdated
+     */
+    public boolean isPostdated()
+    {
+    	return isFlagSet( TicketFlag.POSTDATED );
+    }
+
+    /**
+     * Ticket flag - invalid
+     */
+    public boolean isInvalid()
+    {
+    	return isFlagSet( TicketFlag.INVALID );
+    }
+
+    /**
+     * Ticket flag - renewable
+     */
+    public boolean isRenewable()
+    {
+    	return isFlagSet( TicketFlag.RENEWABLE );
+    }
+
+    /**
+     * Ticket flag - initial
+     */
+    public boolean isInitial()
+    {
+    	return isFlagSet( TicketFlag.INITIAL );
+    }
+
+    /**
+     * Ticket flag - pre-authentication
+     */
+    public boolean isPreAuth()
+    {
+    	return isFlagSet( TicketFlag.PRE_AUTHENT );
+    }
+
+    /**
+     * Ticket flag - hardware authentication
+     */
+    public boolean isHwAuthent()
+    {
+    	return isFlagSet( TicketFlag.HW_AUTHENT );
+    }
+
+    /**
+     * Ticket flag - transitedEncoding policy checked
+     */
+    public boolean isTransitedPolicyChecked()
+    {
+    	return isFlagSet( TicketFlag.TRANSITED_POLICY_CHECKED );
+    }
+
+    /**
+     * Ticket flag - OK as delegate
+     */
+    public boolean isOkAsDelegate()
+    {
+    	return isFlagSet( TicketFlag.OK_AS_DELEGATE );
+    }
+    
+    /**
+     * Converts the object to a printable string.
+     */
+    /*public static String toString( int flags )
+    {
+        StringBuilder result = new StringBuilder();
+
+        if ( ( flags & ( 1 << TicketFlag.RESERVED.getOrdinal() ) ) != 0 )
+        {
+            result.append( "RESERVED " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.FORWARDABLE.getOrdinal() ) ) != 0 )
+        {
+            result.append( "FORWARDABLE " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.FORWARDED.getOrdinal() ) ) != 0 )
+        {
+            result.append( "FORWARDED " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.PROXIABLE.getOrdinal() ) ) != 0 )
+        {
+            result.append( "PROXIABLE " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.PROXY.getOrdinal() ) ) != 0 )
+        {
+            result.append( "PROXY " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.MAY_POSTDATE.getOrdinal() ) ) != 0 )
+        {
+            result.append( "MAY_POSTDATE " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.POSTDATED.getOrdinal() ) ) != 0 )
+        {
+            result.append( "POSTDATED " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.INVALID.getOrdinal() ) ) != 0 )
+        {
+            result.append( "INVALID " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.RENEWABLE.getOrdinal() ) ) != 0 )
+        {
+            result.append( "RENEWABLE " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.INITIAL.getOrdinal() ) ) != 0 )
+        {
+            result.append( "INITIAL " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.PRE_AUTHENT.getOrdinal() ) ) != 0 )
+        {
+            result.append( "PRE_AUTHENT " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.HW_AUTHENT.getOrdinal() ) ) != 0 )
+        {
+            result.append( "HW_AUTHENT " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.TRANSITED_POLICY_CHECKED.getOrdinal() ) ) != 0 )
+        {
+            result.append( "TRANSITED_POLICY_CHECKED " );
+        }
+
+        if ( ( flags & ( 1 << TicketFlag.OK_AS_DELEGATE.getOrdinal() ) ) != 0 )
+        {
+            result.append( "OPTS_OK_AS_DELEGATE " );
+        }
+
+        return result.toString().trim();
+    }*/
+
+    /**
+     * Converts the object to a printable string.
+     */
+    public String toString()
+    {
+        StringBuilder result = new StringBuilder();
+
+        if ( isFlagSet( TicketFlag.RESERVED ) )
+        {
+            result.append( "RESERVED(0) " );
+        }
+
+        if ( isFlagSet( TicketFlag.FORWARDABLE ) )
+        {
+            result.append( "FORWARDABLE(1) " );
+        }
+
+        if ( isFlagSet( TicketFlag.FORWARDED ) )
+        {
+            result.append( "FORWARDED(2) " );
+        }
+
+        if ( isFlagSet( TicketFlag.PROXIABLE ) )
+        {
+            result.append( "PROXIABLE(3) " );
+        }
+
+        if ( isFlagSet( TicketFlag.PROXY ) )
+        {
+            result.append( "PROXY(4) " );
+        }
+
+        if ( isFlagSet( TicketFlag.MAY_POSTDATE ) )
+        {
+            result.append( "MAY_POSTDATE(5) " );
+        }
+
+        if ( isFlagSet( TicketFlag.POSTDATED ) )
+        {
+            result.append( "POSTDATED(6) " );
+        }
+
+        if ( isFlagSet( TicketFlag.INVALID ) )
+        {
+            result.append( "INVALID(7) " );
+        }
+
+        if ( isFlagSet( TicketFlag.RENEWABLE ) )
+        {
+            result.append( "RENEWABLE(8) " );
+        }
+
+        if ( isFlagSet( TicketFlag.INITIAL ) )
+        {
+            result.append( "INITIAL(9) " );
+        }
+
+        if ( isFlagSet( TicketFlag.PRE_AUTHENT ) )
+        {
+            result.append( "PRE_AUTHENT(10) " );
+        }
+
+        if ( isFlagSet( TicketFlag.HW_AUTHENT ) )
+        {
+            result.append( "HW_AUTHENT(11) " );
+        }
+
+        if ( isFlagSet( TicketFlag.TRANSITED_POLICY_CHECKED ) )
+        {
+            result.append( "TRANSITED_POLICY_CHECKED(12) " );
+        }
+
+        if ( isFlagSet( TicketFlag.OK_AS_DELEGATE ) )
+        {
+            result.append( "OK_AS_DELEGATE(13) " );
+        }
+
+        return result.toString().trim();
+    }
+}

Modified: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/package-info.java?rev=578743&r1=578742&r2=578743&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/package-info.java (original)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/package-info.java Mon Sep 24 03:18:05 2007
@@ -26,3 +26,5 @@
  */
 
 package org.apache.directory.server.kerberos.shared.messages.value;
+
+

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/AuthorizationType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/AuthorizationType.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/AuthorizationType.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/AuthorizationType.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,259 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.types;
+
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public enum AuthorizationType
+{
+    /**
+     * Constant for the "null" authorization type.
+     */
+    NULL( 0 ),
+
+    /**
+     * Constant for the "if relevant" authorization type.
+     * 
+     * RFC 4120
+     */
+    AD_IF_RELEVANT( 1 ),
+
+    /**
+     * Constant for the "intended for server" authorization type.
+     * 
+     * RFC 4120
+     */
+    AD_INTENDED_FOR_SERVER( 2 ),
+
+    /**
+     * Constant for the  "intended for application class" authorization type.
+     * 
+     * RFC 4120
+     */
+    AD_INTENDED_FOR_APPLICATION_CLASS( 3 ),
+
+    /**
+     * Constant for the "kdc issued" authorization type.
+     * 
+     * RFC 4120
+     */
+    AD_KDC_ISSUED( 4 ),
+
+    /**
+     * Constant for the "or" authorization type.
+     * 
+     * RFC 4120
+     */
+    AD_OR( 5 ),
+
+    /**
+     * Constant for the "mandatory ticket extensions" authorization type.
+     * 
+     * RFC 4120
+     */
+    AD_MANDATORY_TICKET_EXTENSIONS( 6 ),
+
+    /**
+     * Constant for the "in ticket extensions" authorization type.
+     * 
+     * RFC 4120
+     */
+    AD_IN_TICKET_EXTENSIONS( 7 ),
+
+    /**
+     * Constant for the "mandatory-for-kdc" authorization type.
+     * 
+     * RFC 4120
+     */
+    AD_MANDATORY_FOR_KDC( 8 ),
+
+    /**
+     * Constant for the "OSF DCE" authorization type.
+     * 
+     * RFC 1510
+     */
+    OSF_DCE( 64 ),
+
+    /**
+     * Constant for the "sesame" authorization type.
+     * 
+     * RFC 1510
+     */
+    SESAME( 65 ),
+
+    /**
+     * Constant for the "OSF-DCE pki certid" authorization type.
+     * 
+     * RFC 1510
+     */
+    AD_OSF_DCE_PKI_CERTID( 66 ),
+
+    /**
+     * Constant for the "sesame" authorization type.
+     * 
+     * RFC 1510
+     */
+    AD_WIN2K_PAC( 128 ),
+
+    /**
+     * Constant for the "sesame" authorization type.
+     * 
+     * RFC 1510
+     */
+    AD_ETYPE_NEGOTIATION( 129 );
+
+    /**
+     * Array for building a List of VALUES.
+     */
+    private static final AuthorizationType[] values =
+        { 
+    		NULL, 
+    		AD_IF_RELEVANT, 
+    		AD_INTENDED_FOR_SERVER, 
+    		AD_INTENDED_FOR_APPLICATION_CLASS, 
+    		AD_KDC_ISSUED, 
+    		AD_OR,
+    		AD_MANDATORY_TICKET_EXTENSIONS,
+    		AD_MANDATORY_FOR_KDC,
+    		AD_IN_TICKET_EXTENSIONS, 
+            OSF_DCE, 
+            SESAME,
+            AD_OSF_DCE_PKI_CERTID,
+            AD_WIN2K_PAC,
+            AD_ETYPE_NEGOTIATION
+        };
+
+    /**
+     * A List of all the authorization type constants.
+     */
+    public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) );
+
+    /**
+     * The value/code for the authorization type.
+     */
+    private final int ordinal;
+
+
+    /**
+     * Private constructor prevents construction outside of this class.
+     */
+    private AuthorizationType( int ordinal )
+    {
+        this.ordinal = ordinal;
+    }
+
+
+    /**
+     * Returns the authorization type when specified by its ordinal.
+     *
+     * @param type
+     * @return The authorization type.
+     */
+    public static AuthorizationType getTypeByOrdinal( int type )
+    {
+    	switch ( type )
+    	{
+	    	case 1 : 	return AD_IF_RELEVANT;
+	    	case 2 : 	return AD_INTENDED_FOR_SERVER;
+	    	case 3 :	return AD_INTENDED_FOR_APPLICATION_CLASS;
+	    	case 4 : 	return AD_KDC_ISSUED;
+	    	case 5 : 	return AD_OR;
+	    	case 6 : 	return AD_MANDATORY_TICKET_EXTENSIONS;
+	    	case 7 : 	return AD_IN_TICKET_EXTENSIONS;
+	    	case 8 : 	return AD_MANDATORY_FOR_KDC;
+	    	case 64 : 	return OSF_DCE;
+	    	case 65 : 	return SESAME;
+	    	case 66 : 	return AD_OSF_DCE_PKI_CERTID;
+	    	case 128 : 	return AD_WIN2K_PAC;
+	    	case 129 :	return AD_ETYPE_NEGOTIATION;
+	    	default :  	return NULL;
+    	}
+    }
+
+
+    /**
+     * Returns the number associated with this authorization type.
+     *
+     * @return The authorization type ordinal.
+     */
+    public int getOrdinal()
+    {
+        return ordinal;
+    }
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+    	switch ( this )
+    	{
+    		case AD_IF_RELEVANT 					: 
+    			return "if relevant" + "(" + ordinal + ")";
+    		
+    		case AD_INTENDED_FOR_SERVER : 
+    			return "intended for server" + "(" + ordinal + ")";
+    		
+    		case AD_INTENDED_FOR_APPLICATION_CLASS : 
+    			return "intended for application class" + "(" + ordinal + ")";
+    		
+    		case AD_KDC_ISSUED : 
+    			return "kdc issued" + "(" + ordinal + ")";
+    		
+    		case AD_OR : 
+    			return "or" + "(" + ordinal + ")";
+    		
+    		case AD_MANDATORY_TICKET_EXTENSIONS : 
+    			return "mandatory ticket extensions" + "(" + ordinal + ")";
+    		
+    		case AD_IN_TICKET_EXTENSIONS : 
+    			return "in ticket extensions" + "(" + ordinal + ")";
+    		
+    		case AD_MANDATORY_FOR_KDC : 
+    			return "mandatory-for-kdc" + "(" + ordinal + ")";
+    		
+    		case OSF_DCE : 
+    			return "OSF DCE" + "(" + ordinal + ")";
+    		
+    		case SESAME : 
+    			return "sesame" + "(" + ordinal + ")";
+    			
+    		case AD_OSF_DCE_PKI_CERTID :
+    			return "OSF DCE pki certid" + "(" + ordinal + ")";
+    		
+    		case AD_WIN2K_PAC :
+    			return "win 2000 PAC" + "(" + ordinal + ")";
+    		
+    		case AD_ETYPE_NEGOTIATION :
+    			return "etype negociation" + "(" + ordinal + ")";
+    		
+    		default : 
+    			return "null" + "(" + ordinal + ")";
+    	}
+    }
+}

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/HostAddressType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/HostAddressType.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/HostAddressType.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/HostAddressType.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,271 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.types;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public enum HostAddressType
+{
+    /**
+     * Constant for the "null" host address type.
+     */
+    NULL( 0 ),
+
+    /**
+     * Constant for the "Unix" host address type.
+     * 
+     * Not in RFC
+     */
+    // ADDRTYPE_UNIX( 1 ),
+
+    /**
+     * Constant for the "Internet" host address type.
+     */
+    ADDRTYPE_INET( 2 ),
+
+    /**
+     * Constant for the "Arpanet" host address type.
+     */
+    ADDRTYPE_IMPLINK( 3 ),
+
+    /**
+     * Constant for the "PUP" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_PUP( 4 ),
+
+    /**
+     * Constant for the "CHAOS" host address type.
+     */
+    ADDRTYPE_CHAOS( 5 ),
+
+    /**
+     * Constant for the "XEROX Network Services" host address type.
+     */
+    ADDRTYPE_XNS( 6 ),
+
+    /**
+     * Constant for the "IPX" host address type.
+     * 
+     * Not in RFC
+     */
+    // ADDRTYPE_IPX( 6 ),
+
+    /**
+     * Constant for the "OSI" host address type.
+     */
+    ADDRTYPE_OSI( 7 ),
+
+    /**
+     * Constant for the "European Computer Manufacturers" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_ECMA( 8 ),
+
+    /**
+     * Constant for the "Datakit" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_DATAKIT( 9 ),
+
+    /**
+     * Constant for the "CCITT" host address type.
+     * 
+     * Not in RFC
+     */
+    //pADDRTYPE_CCITT( 10 ),
+
+    /**
+     * Constant for the "SNA" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_SNA( 11 ),
+
+    /**
+     * Constant for the "DECnet" host address type.
+     */
+    ADDRTYPE_DECNET( 12 ),
+
+    /**
+     * Constant for the "Direct Data Link Interface" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_DLI( 13 ),
+
+    /**
+     * Constant for the "LAT" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_LAT( 14 ),
+
+    /**
+     * Constant for the "NSC Hyperchannel" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_HYLINK( 15 ),
+
+    /**
+     * Constant for the "AppleTalk" host address type.
+     */
+    ADDRTYPE_APPLETALK( 16 ),
+
+    /**
+     * Constant for the "VoiceView" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_VOICEVIEW( 18 ),
+
+    /**
+     * Constant for the "Firefox" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_FIREFOX( 19 ),
+
+    /**
+     * Constant for the "NetBios" host address type.
+     * 
+     * Not in RFC
+     */
+    ADDRTYPE_NETBIOS( 20 ),
+
+    /**
+     * Constant for the "Banyan" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_BAN( 21 ),
+
+    /**
+     * Constant for the "ATM" host address type.
+     * 
+     * Not in RFC
+     */
+    //ADDRTYPE_ATM( 22 ),
+
+    /**
+     * Constant for the "Internet Protocol V6" host address type.
+     */
+    ADDRTYPE_INET6( 24 );
+
+    /**
+     * The value/code for the host address type.
+     */
+    private final int ordinal;
+
+
+    /**
+     * Private constructor prevents construction outside of this class.
+     */
+    private HostAddressType( int ordinal )
+    {
+        this.ordinal = ordinal;
+    }
+
+
+    /**
+     * Returns the host address type when specified by its ordinal.
+     *
+     * @param type
+     * @return The host address type.
+     */
+    public static HostAddressType getTypeByOrdinal( int type )
+    {
+    	switch ( type )
+    	{
+    		case 0 : return NULL;
+    		//case 1 : return ADDRTYPE_UNIX;
+    		case 2 : return ADDRTYPE_INET;
+    		case 3 : return ADDRTYPE_IMPLINK;
+    		//case 4 : return ADDRTYPE_PUP;
+    		case 5 : return ADDRTYPE_CHAOS;
+    		case 6 : return ADDRTYPE_XNS;
+    		case 7 : return ADDRTYPE_OSI;
+    		//case 8 : return ADDRTYPE_ECMA;
+    		//case 9 : return ADDRTYPE_DATAKIT;
+    		//case 10 : return pADDRTYPE_CCITT;
+    		//case 11 : return ADDRTYPE_SNA;
+    		case 12 : return ADDRTYPE_DECNET;
+    		//case 13 : return ADDRTYPE_DLI;
+    		//case 14 : return ADDRTYPE_LAT;
+    		//case 15 : return ADDRTYPE_HYLINK;
+    		case 16 : return ADDRTYPE_APPLETALK;
+    		//case 18 : return ADDRTYPE_VOICEVIEW;
+    		//case 19 : return ADDRTYPE_FIREFOX;
+    		case 20 : return ADDRTYPE_NETBIOS;
+    		//case 21 : return ADDRTYPE_BAN;
+    		//case 22 : return ADDRTYPE_ATM;
+    		case 24 : return ADDRTYPE_INET6;
+    		default : return NULL;
+    	}
+    }
+
+
+    /**
+     * Returns the number associated with this host address type.
+     *
+     * @return The host address type ordinal.
+     */
+    public int getOrdinal()
+    {
+        return ordinal;
+    }
+
+    public String toString()
+    {
+    	switch ( ordinal )
+    	{
+    		//case 1 : return "Unix" + "(" + ordinal + ")"  ;
+    		case 2 : return "Internet" + "(" + ordinal + ")"  ;
+    		case 3 : return "Arpanet" + "(" + ordinal + ")"  ;
+    		//case 4 : return "PUP" + "(" + ordinal + ")"  ;
+    		case 5 : return "CHAOS" + "(" + ordinal + ")"  ;
+    		case 6 : return "XEROX Network Services" + "(" + ordinal + ")"  ;
+    		case 7 : return "OSI" + "(" + ordinal + ")"  ;
+    		//case 8 : return "European Computer Manufacturers" + "(" + ordinal + ")"  ;
+    		//case 9 : return "Datakit" + "(" + ordinal + ")"  ;
+    		//case 10 : return "CCITT" + "(" + ordinal + ")"  ;
+    		//case 11 : return "SNA" + "(" + ordinal + ")"  ;
+    		case 12 : return "DECnet" + "(" + ordinal + ")"  ;
+    		//case 13 : return "Direct Data Link Interface" + "(" + ordinal + ")"  ;
+    		//case 14 : return "LAT" + "(" + ordinal + ")"  ;
+    		//case 15 : return "NSC Hyperchannel" + "(" + ordinal + ")"  ;
+    		//case 16 : return "AppleTalk" + "(" + ordinal + ")"  ;
+    		//case 18 : return "VoiceView" + "(" + ordinal + ")"  ;
+    		//case 19 : return "Firefox" + "(" + ordinal + ")"  ;
+    		case 20 : return "NetBios" + "(" + ordinal + ")"  ;
+    		//case 21 : return "Banyan" + "(" + ordinal + ")"  ;
+    		//case 22 : return "ATM" + "(" + ordinal + ")"  ;
+    		case 24 : return "Internet Protocol V6" + "(" + ordinal + ")" ; 			
+    		default : return "null" + "(" + ordinal + ")" ;
+    	}
+    }
+}

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/KerberosErrorType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/KerberosErrorType.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/KerberosErrorType.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/KerberosErrorType.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,563 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.types;
+
+
+/**
+ * The Kerberos Error codes
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public enum KerberosErrorType
+{
+    /** No error */
+    KDC_ERR_NONE(0),
+    
+    /** Client's entry in database has expired */
+    KDC_ERR_NAME_EXP(1),
+
+    /** Server's entry in database has expired */
+    KDC_ERR_SERVICE_EXP(2),  
+                          
+    /** Requested protocol version number not supported */
+    KDC_ERR_BAD_PVNO(3),  
+    
+    /** Client's key encrypted in old master key */ 
+    KDC_ERR_C_OLD_MAST_KVNO(4),
+    
+    /** Server's key encrypted in old master key */ 
+    KDC_ERR_S_OLD_MAST_KVNO(5),
+    
+    /** Client not found in Kerberos database */ 
+    KDC_ERR_C_PRINCIPAL_UNKNOWN(6),
+    
+    /** Server not found in Kerberos database */ 
+    KDC_ERR_S_PRINCIPAL_UNKNOWN(7),
+    
+    /** Multiple principal entries in database */ 
+    KDC_ERR_PRINCIPAL_NOT_UNIQUE(8),
+    
+    /** The client or server has a null key */ 
+    KDC_ERR_NULL_KEY(9),
+    
+    /** Ticket not eligible for postdating */ 
+    KDC_ERR_CANNOT_POSTDATE(10),
+    
+    /** Requested starttime is later than end time */ 
+    KDC_ERR_NEVER_VALID(11),
+    
+    /** KDC policy rejects request */ 
+    KDC_ERR_POLICY(12),
+    
+    /** KDC cannot accommodate requested option */ 
+    KDC_ERR_BADOPTION(13),
+    
+    /** KDC has no support for encryption type */ 
+    KDC_ERR_ETYPE_NOSUPP(14),
+    
+    /** KDC has no support for checksum type */ 
+    KDC_ERR_SUMTYPE_NOSUPP(15),
+    
+    /** KDC has no support for padata type */ 
+    KDC_ERR_PADATA_TYPE_NOSUPP(16),
+    
+    /** KDC has no support for transited type */ 
+    KDC_ERR_TRTYPE_NOSUPP(17),
+    
+    /** Clients credentials have been revoked */ 
+    KDC_ERR_CLIENT_REVOKED(18),
+    
+    /** Credentials for server have been revoked */ 
+    KDC_ERR_SERVICE_REVOKED(19),
+    
+    /** TGT has been revoked */ 
+    KDC_ERR_TGT_REVOKED(20),
+    
+    /** Client not yet valid; try again later */ 
+    KDC_ERR_CLIENT_NOTYET(21),
+    
+    /** Server not yet valid; try again later */ 
+    KDC_ERR_SERVICE_NOTYET(22),
+    
+    /** Password has expired; change password to reset */ 
+    KDC_ERR_KEY_EXPIRED(23),
+    
+    /** Pre-authentication information was invalid */ 
+    KDC_ERR_PREAUTH_FAILED(24),
+    
+    /** Additional pre-authentication required */ 
+    KDC_ERR_PREAUTH_REQUIRED(25),
+    
+    /** Requested server and ticket don't match */ 
+    KDC_ERR_SERVER_NOMATCH(26),
+    
+    /** Server principal valid for user2user only */
+    
+    KDC_ERR_MUST_USE_USER2USER(27),  
+    
+    /** KDC Policy rejects transited path */ 
+    KDC_ERR_PATH_NOT_ACCEPTED(28),
+    
+    /** A service is not available */ 
+    KDC_ERR_SVC_UNAVAILABLE(29),
+    
+    /** Integrity check on decrypted field failed */ 
+    KRB_AP_ERR_BAD_INTEGRITY(31),
+    
+    /** Ticket expired */ 
+    KRB_AP_ERR_TKT_EXPIRED(32),
+    
+    /** Ticket not yet valid */ 
+    KRB_AP_ERR_TKT_NYV(33),
+    
+    /** Request is a replay */ 
+    KRB_AP_ERR_REPEAT(34),
+    
+    /** The ticket isn't for us */ 
+    KRB_AP_ERR_NOT_US(35),
+    
+    /** Ticket and authenticator don't match */ 
+    KRB_AP_ERR_BADMATCH(36),
+    
+    /** Clock skew too great */ 
+    KRB_AP_ERR_SKEW(37),
+    
+    /** Incorrect net address */ 
+    KRB_AP_ERR_BADADDR(38),
+    
+    /** Protocol version mismatch */ 
+    KRB_AP_ERR_BADVERSION(39),
+    
+    /** Invalid msg type */ 
+    KRB_AP_ERR_MSG_TYPE(40),
+    
+    /** Message stream modified */ 
+    KRB_AP_ERR_MODIFIED(41),
+    
+    /** Message out of order */ 
+    KRB_AP_ERR_BADORDER(42),
+    
+    /** Specified version of key is not available */ 
+    KRB_AP_ERR_BADKEYVER(44),
+    
+    /** Service key not available */ 
+    KRB_AP_ERR_NOKEY(45),
+    
+    /** Mutual authentication failed */ 
+    KRB_AP_ERR_MUT_FAIL(46),
+    
+    /** Incorrect message direction */ 
+    KRB_AP_ERR_BADDIRECTION(47),
+    
+    /** Alternative authentication method required */ 
+    KRB_AP_ERR_METHOD(48),
+    
+    /** Incorrect sequence number in message */ 
+    KRB_AP_ERR_BADSEQ(49),
+    
+    /** Inappropriate type of checksum in message */ 
+    KRB_AP_ERR_INAPP_CKSUM(50),
+    
+    /** Policy rejects transited path */ 
+    KRB_AP_PATH_NOT_ACCEPTED(51),
+    
+    /** Response too big for UDP; retry with TCP */ 
+    KRB_ERR_RESPONSE_TOO_BIG(52),
+    
+    /** Generic error (description in e-text) */ 
+    KRB_ERR_GENERIC(60),
+    
+    /** Field is too long for this implementation */ 
+    KRB_ERR_FIELD_TOOLONG(61),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERROR_CLIENT_NOT_TRUSTED(62),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERROR_KDC_NOT_TRUSTED(63),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERROR_INVALID_SIG(64),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERR_KEY_TOO_WEAK(65),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERR_CERTIFICATE_MISMATCH(66),
+    
+    /** No TGT available to validate USER-TO-USER */ 
+    KRB_AP_ERR_NO_TGT(67),
+    
+    /** Reserved for future use */ 
+    KDC_ERR_WRONG_REALM(68),
+    
+    /** Ticket must be for USER-TO-USER */ 
+    KRB_AP_ERR_USER_TO_USER_REQUIRED(69),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERR_CANT_VERIFY_CERTIFICATE(70),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERR_INVALID_CERTIFICATE(71),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERR_REVOKED_CERTIFICATE(72),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERR_REVOCATION_STATUS_UNKNOWN(73),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERR_REVOCATION_STATUS_UNAVAILABLE(74),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERR_CLIENT_NAME_MISMATCH(75),
+    
+    /** Reserved for PKINIT */ 
+    KDC_ERR_KDC_NAME_MISMATCH(76),
+    
+    /** No error */
+    NULL(-1);
+    
+    
+
+    /**
+     * The value/code for the authorization type.
+     */
+    private final int ordinal;
+
+    /**
+     * Private constructor prevents construction outside of this class.
+     */
+    private KerberosErrorType( int ordinal )
+    {
+        this.ordinal = ordinal;
+    }
+
+
+    /**
+     * Returns the authorization type when specified by its ordinal.
+     *
+     * @param type
+     * @return The authorization type.
+     */
+    public static KerberosErrorType getTypeByOrdinal( int type )
+    {
+    	switch ( type )
+    	{
+            case 0 : return KDC_ERR_NONE;
+            case 1 : return KDC_ERR_NAME_EXP;
+            case 2 : return KDC_ERR_SERVICE_EXP;
+            case 3 : return KDC_ERR_BAD_PVNO;
+            case 4 : return KDC_ERR_C_OLD_MAST_KVNO;
+            case 5 : return KDC_ERR_S_OLD_MAST_KVNO;
+            case 6 : return KDC_ERR_C_PRINCIPAL_UNKNOWN;
+            case 7 : return KDC_ERR_S_PRINCIPAL_UNKNOWN;
+            case 8 : return KDC_ERR_PRINCIPAL_NOT_UNIQUE;
+            case 9 : return KDC_ERR_NULL_KEY;
+            case 10 : return KDC_ERR_CANNOT_POSTDATE;
+            case 11 : return KDC_ERR_NEVER_VALID;
+            case 12 : return KDC_ERR_POLICY;
+            case 13 : return KDC_ERR_BADOPTION;
+            case 14 : return KDC_ERR_ETYPE_NOSUPP;
+            case 15 : return KDC_ERR_SUMTYPE_NOSUPP;
+            case 16 : return KDC_ERR_PADATA_TYPE_NOSUPP;
+            case 17 : return KDC_ERR_TRTYPE_NOSUPP;
+            case 18 : return KDC_ERR_CLIENT_REVOKED;
+            case 19 : return KDC_ERR_SERVICE_REVOKED;
+            case 20 : return KDC_ERR_TGT_REVOKED;
+            case 21 : return KDC_ERR_CLIENT_NOTYET;
+            case 22 : return KDC_ERR_SERVICE_NOTYET;
+            case 23 : return KDC_ERR_KEY_EXPIRED;
+            case 24 : return KDC_ERR_PREAUTH_FAILED;
+            case 25 : return KDC_ERR_PREAUTH_REQUIRED;
+            case 26 : return KDC_ERR_SERVER_NOMATCH;
+            case 27 : return KDC_ERR_MUST_USE_USER2USER;
+            case 28 : return KDC_ERR_PATH_NOT_ACCEPTED;
+            case 29 : return KDC_ERR_SVC_UNAVAILABLE;
+            case 31 : return KRB_AP_ERR_BAD_INTEGRITY;
+            case 32 : return KRB_AP_ERR_TKT_EXPIRED;
+            case 33 : return KRB_AP_ERR_TKT_NYV;
+            case 34 : return KRB_AP_ERR_REPEAT;
+            case 35 : return KRB_AP_ERR_NOT_US;
+            case 36 : return KRB_AP_ERR_BADMATCH;
+            case 37 : return KRB_AP_ERR_SKEW;
+            case 38 : return KRB_AP_ERR_BADADDR;
+            case 39 : return KRB_AP_ERR_BADVERSION;
+            case 40 : return KRB_AP_ERR_MSG_TYPE;
+            case 41 : return KRB_AP_ERR_MODIFIED;
+            case 42 : return KRB_AP_ERR_BADORDER;
+            case 44 : return KRB_AP_ERR_BADKEYVER;
+            case 45 : return KRB_AP_ERR_NOKEY;
+            case 46 : return KRB_AP_ERR_MUT_FAIL;
+            case 47 : return KRB_AP_ERR_BADDIRECTION;
+            case 48 : return KRB_AP_ERR_METHOD;
+            case 49 : return KRB_AP_ERR_BADSEQ;
+            case 50 : return KRB_AP_ERR_INAPP_CKSUM;
+            case 51 : return KRB_AP_PATH_NOT_ACCEPTED;
+            case 52 : return KRB_ERR_RESPONSE_TOO_BIG;
+            case 60 : return KRB_ERR_GENERIC;
+            case 61 : return KRB_ERR_FIELD_TOOLONG;
+            case 62 : return KDC_ERROR_CLIENT_NOT_TRUSTED;
+            case 63 : return KDC_ERROR_KDC_NOT_TRUSTED;
+            case 64 : return KDC_ERROR_INVALID_SIG;
+            case 65 : return KDC_ERR_KEY_TOO_WEAK;
+            case 66 : return KDC_ERR_CERTIFICATE_MISMATCH;
+            case 67 : return KRB_AP_ERR_NO_TGT;
+            case 68 : return KDC_ERR_WRONG_REALM;
+            case 69 : return KRB_AP_ERR_USER_TO_USER_REQUIRED;
+            case 70 : return KDC_ERR_CANT_VERIFY_CERTIFICATE;
+            case 71 : return KDC_ERR_INVALID_CERTIFICATE;
+            case 72 : return KDC_ERR_REVOKED_CERTIFICATE;
+            case 73 : return KDC_ERR_REVOCATION_STATUS_UNKNOWN;
+            case 74 : return KDC_ERR_REVOCATION_STATUS_UNAVAILABLE;
+            case 75 : return KDC_ERR_CLIENT_NAME_MISMATCH;
+            case 76 : return KDC_ERR_KDC_NAME_MISMATCH;
+	    	default : return NULL;
+    	}
+    }
+
+
+    /**
+     * Returns the number associated with this authorization type.
+     *
+     * @return The authorization type ordinal.
+     */
+    public int getOrdinal()
+    {
+        return ordinal;
+    }
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+    	switch ( this )
+    	{
+            case KDC_ERR_NONE : 
+                return "No error" + "(" + ordinal + ")";
+            
+            case KDC_ERR_NAME_EXP : 
+                return "Client's entry in database has expired" + "(" + ordinal + ")";
+            
+            case KDC_ERR_SERVICE_EXP : 
+                return "Server's entry in database has expired" + "(" + ordinal + ")";
+            
+            case KDC_ERR_BAD_PVNO : 
+                return "Requested protocol version number not supported" + "(" + ordinal + ")";
+            
+            case KDC_ERR_C_OLD_MAST_KVNO : 
+                return "Client's key encrypted in old master key" + "(" + ordinal + ")";
+            
+            case KDC_ERR_S_OLD_MAST_KVNO : 
+                return "Server's key encrypted in old master key" + "(" + ordinal + ")";
+            
+            case KDC_ERR_C_PRINCIPAL_UNKNOWN : 
+                return "Client not found in Kerberos database" + "(" + ordinal + ")";
+            
+            case KDC_ERR_S_PRINCIPAL_UNKNOWN : 
+                return "Server not found in Kerberos database" + "(" + ordinal + ")";
+            
+            case KDC_ERR_PRINCIPAL_NOT_UNIQUE : 
+                return "Multiple principal entries in database" + "(" + ordinal + ")";
+            
+            case KDC_ERR_NULL_KEY : 
+                return "The client or server has a null key" + "(" + ordinal + ")";
+            
+            case KDC_ERR_CANNOT_POSTDATE : 
+                return "Ticket not eligible for postdating" + "(" + ordinal + ")";
+            
+            case KDC_ERR_NEVER_VALID : 
+                return "Requested starttime is later than end time" + "(" + ordinal + ")";
+            
+            case KDC_ERR_POLICY : 
+                return "KDC policy rejects request" + "(" + ordinal + ")";
+            
+            case KDC_ERR_BADOPTION : 
+                return "KDC cannot accommodate requested option" + "(" + ordinal + ")";
+            
+            case KDC_ERR_ETYPE_NOSUPP : 
+                return "KDC has no support for encryption type" + "(" + ordinal + ")";
+            
+            case KDC_ERR_SUMTYPE_NOSUPP : 
+                return "KDC has no support for checksum type" + "(" + ordinal + ")";
+            
+            case KDC_ERR_PADATA_TYPE_NOSUPP : 
+                return "KDC has no support for padata type" + "(" + ordinal + ")";
+            
+            case KDC_ERR_TRTYPE_NOSUPP : 
+                return "KDC has no support for transited type" + "(" + ordinal + ")";
+            
+            case KDC_ERR_CLIENT_REVOKED : 
+                return "Clients credentials have been revoked" + "(" + ordinal + ")";
+            
+            case KDC_ERR_SERVICE_REVOKED : 
+                return "Credentials for server have been revoked" + "(" + ordinal + ")";
+            
+            case KDC_ERR_TGT_REVOKED : 
+                return "TGT has been revoked" + "(" + ordinal + ")";
+            
+            case KDC_ERR_CLIENT_NOTYET : 
+                return "Client not yet valid; try again later" + "(" + ordinal + ")";
+            
+            case KDC_ERR_SERVICE_NOTYET : 
+                return "Server not yet valid; try again later" + "(" + ordinal + ")";
+            
+            case KDC_ERR_KEY_EXPIRED : 
+                return "Password has expired; change password to reset" + "(" + ordinal + ")";
+            
+            case KDC_ERR_PREAUTH_FAILED : 
+                return "Pre-authentication information was invalid" + "(" + ordinal + ")";
+            
+            case KDC_ERR_PREAUTH_REQUIRED : 
+                return "Additional pre-authentication required" + "(" + ordinal + ")";
+            
+            case KDC_ERR_SERVER_NOMATCH : 
+                return "Requested server and ticket don't match" + "(" + ordinal + ")";
+            
+            case KDC_ERR_MUST_USE_USER2USER : 
+                return "Server principal valid for user2user only" + "(" + ordinal + ")";
+            
+            case KDC_ERR_PATH_NOT_ACCEPTED : 
+                return "KDC Policy rejects transited path" + "(" + ordinal + ")";
+            
+            case KDC_ERR_SVC_UNAVAILABLE : 
+                return "A service is not available" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_BAD_INTEGRITY : 
+                return "Integrity check on decrypted field failed" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_TKT_EXPIRED : 
+                return "Ticket expired" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_TKT_NYV : 
+                return "Ticket not yet valid" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_REPEAT : 
+                return "Request is a replay" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_NOT_US : 
+                return "The ticket isn't for us" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_BADMATCH : 
+                return "Ticket and authenticator don't match" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_SKEW : 
+                return "Clock skew too great" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_BADADDR : 
+                return "Incorrect net address" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_BADVERSION : 
+                return "Protocol version mismatch" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_MSG_TYPE : 
+                return "Invalid msg type" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_MODIFIED : 
+                return "Message stream modified" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_BADORDER : 
+                return "Message out of order" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_BADKEYVER : 
+                return "Specified version of key is not available" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_NOKEY : 
+                return "Service key not available" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_MUT_FAIL : 
+                return "Mutual authentication failed" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_BADDIRECTION : 
+                return "Incorrect message direction" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_METHOD : 
+                return "Alternative authentication method required" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_BADSEQ : 
+                return "Incorrect sequence number in message" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_INAPP_CKSUM : 
+                return "Inappropriate type of checksum in message" + "(" + ordinal + ")";
+            
+            case KRB_AP_PATH_NOT_ACCEPTED : 
+                return "Policy rejects transited path" + "(" + ordinal + ")";
+            
+            case KRB_ERR_RESPONSE_TOO_BIG : 
+                return "Response too big for UDP; retry with TCP" + "(" + ordinal + ")";
+            
+            case KRB_ERR_GENERIC : 
+                return "Generic error (description in e-text)" + "(" + ordinal + ")";
+            
+            case KRB_ERR_FIELD_TOOLONG : 
+                return "Field is too long for this implementation" + "(" + ordinal + ")";
+            
+            case KDC_ERROR_CLIENT_NOT_TRUSTED : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KDC_ERROR_KDC_NOT_TRUSTED : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KDC_ERROR_INVALID_SIG : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KDC_ERR_KEY_TOO_WEAK : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KDC_ERR_CERTIFICATE_MISMATCH : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_NO_TGT : 
+                return "No TGT available to validate USER-TO-USER" + "(" + ordinal + ")";
+            
+            case KDC_ERR_WRONG_REALM : 
+                return "Reserved for future use" + "(" + ordinal + ")";
+            
+            case KRB_AP_ERR_USER_TO_USER_REQUIRED : 
+                return "Ticket must be for USER-TO-USER" + "(" + ordinal + ")";
+            
+            case KDC_ERR_CANT_VERIFY_CERTIFICATE : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KDC_ERR_INVALID_CERTIFICATE :
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KDC_ERR_REVOKED_CERTIFICATE : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KDC_ERR_REVOCATION_STATUS_UNKNOWN : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KDC_ERR_REVOCATION_STATUS_UNAVAILABLE : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KDC_ERR_CLIENT_NAME_MISMATCH : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+            
+            case KDC_ERR_KDC_NAME_MISMATCH : 
+                return "Reserved for PKINIT" + "(" + ordinal + ")";
+
+            default : 
+    			return "null" + "(" + ordinal + ")";
+    	}
+    }
+}

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/LastRequestType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/LastRequestType.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/LastRequestType.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/LastRequestType.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,143 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.types;
+
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public final class LastRequestType implements Comparable
+{
+    /**
+     * Constant for the "none" last request type.
+     */
+    public static final LastRequestType NONE = new LastRequestType( 0, "none" );
+
+    /**
+     * Constant for the "time of initial ticket" last request type.
+     */
+    public static final LastRequestType TIME_OF_INITIAL_TGT = new LastRequestType( 1, "time of initial ticket" );
+
+    /**
+     * Constant for the "time of initial request" last request type.
+     */
+    public static final LastRequestType TIME_OF_INITIAL_REQ = new LastRequestType( 2, "time of initial request" );
+
+    /**
+     * Constant for the "time of newest ticket" last request type.
+     */
+    public static final LastRequestType TIME_OF_NEWEST_TGT = new LastRequestType( 3, "time of newest ticket" );
+
+    /**
+     * Constant for the "time of last renewal" last request type.
+     */
+    public static final LastRequestType TIME_OF_LAST_RENEWAL = new LastRequestType( 4, "time of last renewal" );
+
+    /**
+     * Constant for the "time of last request" last request type.
+     */
+    public static final LastRequestType TIME_OF_LAST_REQ = new LastRequestType( 5, "time of last request" );
+
+    /**
+     * Constant for the "time of password expiration" last request type.
+     */
+    public static final LastRequestType TIME_OF_PASSWORD_EXP = new LastRequestType( 6, "time of password expiration" );
+
+    /**
+     * Array for building a List of VALUES.
+     */
+    private static final LastRequestType[] values =
+        { NONE, TIME_OF_INITIAL_TGT, TIME_OF_INITIAL_REQ, TIME_OF_NEWEST_TGT, TIME_OF_LAST_RENEWAL, TIME_OF_LAST_REQ,
+            TIME_OF_PASSWORD_EXP };
+
+    /**
+     * A List of all the last request type constants.
+     */
+    public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) );
+
+    /**
+     * The name of the checksum type.
+     */
+    private final String name;
+
+    /**
+     * The value/code for the checksum type.
+     */
+    private final int ordinal;
+
+
+    /**
+     * Private constructor prevents construction outside of this class.
+     */
+    private LastRequestType( int ordinal, String name )
+    {
+        this.ordinal = ordinal;
+        this.name = name;
+    }
+
+
+    /**
+     * Returns the last request type when specified by its ordinal.
+     *
+     * @param type
+     * @return The last request type.
+     */
+    public static LastRequestType getTypeByOrdinal( int type )
+    {
+        for ( int ii = 0; ii < values.length; ii++ )
+        {
+            if ( values[ii].ordinal == type )
+            {
+                return values[ii];
+            }
+        }
+
+        return NONE;
+    }
+
+
+    /**
+     * Returns the number associated with this last request type.
+     *
+     * @return The last request type ordinal.
+     */
+    public int getOrdinal()
+    {
+        return ordinal;
+    }
+
+
+    public int compareTo( Object that )
+    {
+        return ordinal - ( ( LastRequestType ) that ).ordinal;
+    }
+
+
+    public String toString()
+    {
+        return name + " (" + ordinal + ")";
+    }
+}

Added: directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/PreAuthenticationDataType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/PreAuthenticationDataType.java?rev=578743&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/PreAuthenticationDataType.java (added)
+++ directory/apacheds/branches/apacheds-kerberos/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/types/PreAuthenticationDataType.java Mon Sep 24 03:18:05 2007
@@ -0,0 +1,255 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.kerberos.shared.messages.value.types;
+
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-22 02:00:43 +0200 (Tue, 22 May 2007) $
+ */
+public enum PreAuthenticationDataType
+{
+    /**
+     * Constant for the "null" pre-authentication data type.
+     */
+    NULL( 0 ),
+
+    /**
+     * Constant for the "TGS request" pre-authentication data type.
+     */
+    PA_TGS_REQ( 1 ),
+
+    /**
+     * Constant for the "encrypted timestamp" pre-authentication data type.
+     */
+    PA_ENC_TIMESTAMP( 2 ),
+
+    /**
+     * Constant for the "password salt" pre-authentication data type.
+     */
+    PA_PW_SALT( 3 ),
+
+    /**
+     * Constant for the "enc unix time" pre-authentication data type.
+     */
+    PA_ENC_UNIX_TIME( 5 ),
+
+    /**
+     * Constant for the "sandia secureid" pre-authentication data type.
+     */
+    PA_SANDIA_SECUREID( 6 ),
+
+    /**
+     * Constant for the "sesame" pre-authentication data type.
+     */
+    PA_SESAME( 7 ),
+
+    /**
+     * Constant for the "OSF DCE" pre-authentication data type.
+     */
+    PA_OSF_DCE( 8 ),
+
+    /**
+     * Constant for the "cybersafe secureid" pre-authentication data type.
+     */
+    PA_CYBERSAFE_SECUREID( 9 ),
+
+    /**
+     * Constant for the "ASF3 salt" pre-authentication data type.
+     */
+    PA_ASF3_SALT( 10 ),
+
+    /**
+     * Constant for the "encryption info" pre-authentication data type.
+     */
+    PA_ENCTYPE_INFO( 11 ),
+
+    /**
+     * Constant for the "SAM challenge" pre-authentication data type.
+     */
+    SAM_CHALLENGE( 12 ),
+
+    /**
+     * Constant for the "SAM response" pre-authentication data type.
+     */
+    SAM_RESPONSE( 13 ),
+
+    /**
+     * Constant for the "PK as request" pre-authentication data type.
+     */
+    PA_PK_AS_REQ( 14 ),
+
+    /**
+     * Constant for the "PK as response" pre-authentication data type.
+     */
+    PA_PK_AS_REP( 15 ),
+
+    /**
+     * Constant for the "use specified key version" pre-authentication data type.
+     */
+    PA_USE_SPECIFIED_KVNO( 20 ),
+
+    /**
+     * Constant for the "SAM redirect" pre-authentication data type.
+     */
+    SAM_REDIRECT( 21 ),
+
+    /**
+     * Constant for the "get from typed data" pre-authentication data type.
+     */
+    PA_GET_FROM_TYPED_DATA( 22 );
+
+    /**
+     * Array for building a List of VALUES.
+     */
+    private static final PreAuthenticationDataType[] values =
+        { NULL, PA_TGS_REQ, PA_ENC_TIMESTAMP, PA_PW_SALT, PA_ENC_UNIX_TIME, PA_SANDIA_SECUREID, PA_SESAME, PA_OSF_DCE,
+            PA_CYBERSAFE_SECUREID, PA_ASF3_SALT, PA_ENCTYPE_INFO, SAM_CHALLENGE, SAM_RESPONSE, PA_PK_AS_REQ,
+            PA_PK_AS_REP, PA_USE_SPECIFIED_KVNO, SAM_REDIRECT, PA_GET_FROM_TYPED_DATA };
+
+    /**
+     * A list of all the pre-authentication type constants.
+     */
+    public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) );
+
+    /**
+     * The value/code for the pre-authentication type.
+     */
+    private final int ordinal;
+
+
+    /**
+     * Private constructor prevents construction outside of this class.
+     */
+    private PreAuthenticationDataType( int ordinal )
+    {
+        this.ordinal = ordinal;
+    }
+
+
+    /**
+     * Returns the number associated with this pre-authentication type.
+     *
+     * @return The pre-authentication type ordinal.
+     */
+    public int getOrdinal()
+    {
+        return ordinal;
+    }
+    
+    /**
+     * Returns the pre authentication data type when specified by its ordinal.
+     *
+     * @param type The ordinal
+     * @return The pre authentication type.
+     */
+    public static PreAuthenticationDataType getTypeByOrdinal( int type )
+    {
+        switch ( type )
+        {
+            case 1 :    return PA_TGS_REQ;
+            case 2 :    return PA_ENC_TIMESTAMP;
+            case 3 :    return PA_PW_SALT;
+            case 5 :    return PA_ENC_UNIX_TIME;
+            case 6 :    return PA_SANDIA_SECUREID;
+            case 7 :    return PA_SESAME;
+            case 8 :    return PA_OSF_DCE;
+            case 9 :    return PA_CYBERSAFE_SECUREID;
+            case 10 :   return PA_ASF3_SALT;
+            case 11 :   return PA_ENCTYPE_INFO;
+            case 12 :   return SAM_CHALLENGE;
+            case 13 :   return SAM_RESPONSE;
+            case 14 :   return PA_PK_AS_REQ;
+            case 15 :   return PA_PK_AS_REQ;
+            case 20 :   return PA_USE_SPECIFIED_KVNO;
+            case 21 :   return SAM_REDIRECT;
+            case 22 :   return PA_GET_FROM_TYPED_DATA;
+            default :   return NULL;
+        }
+    }
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        switch ( this )
+        {
+            case PA_TGS_REQ                     : 
+                return "TGS request." + "(" + ordinal + ")";
+            
+            case PA_ENC_TIMESTAMP : 
+                return "Encrypted timestamp." + "(" + ordinal + ")";
+            
+            case PA_PW_SALT : 
+                return "password salt" + "(" + ordinal + ")";
+            
+            case PA_ENC_UNIX_TIME : 
+                return "enc unix time" + "(" + ordinal + ")";
+            
+            case PA_SANDIA_SECUREID : 
+                return "sandia secureid" + "(" + ordinal + ")";
+            
+            case PA_SESAME : 
+                return "sesame" + "(" + ordinal + ")";
+            
+            case PA_OSF_DCE : 
+                return "OSF DCE" + "(" + ordinal + ")";
+            
+            case PA_CYBERSAFE_SECUREID : 
+                return "cybersafe secureid" + "(" + ordinal + ")";
+            
+            case PA_ASF3_SALT : 
+                return "ASF3 salt" + "(" + ordinal + ")";
+            
+            case PA_ENCTYPE_INFO : 
+                return "Encryption info." + "(" + ordinal + ")";
+            
+            case SAM_CHALLENGE : 
+                return "SAM challenge." + "(" + ordinal + ")";
+            
+            case SAM_RESPONSE : 
+                return "SAM response." + "(" + ordinal + ")";
+            
+            case PA_PK_AS_REQ : 
+                return "PK as request" + "(" + ordinal + ")";
+            
+            case PA_PK_AS_REP : 
+                return "PK as response" + "(" + ordinal + ")";
+                
+            case PA_USE_SPECIFIED_KVNO :
+                return "use specified key version" + "(" + ordinal + ")";
+            
+            case SAM_REDIRECT :
+                return "SAM redirect." + "(" + ordinal + ")";
+            
+            case PA_GET_FROM_TYPED_DATA :
+                return "Get from typed data" + "(" + ordinal + ")";
+            
+            default : 
+                return "null" + "(" + ordinal + ")";
+        }
+    }
+}
\ No newline at end of file



Mime
View raw message