001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    package org.apache.directory.server.kerberos.shared.messages.value;
021    
022    
023    /**
024     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
025     * @version $Rev: 558293 $, $Date: 2007-07-21 12:51:06 +0200 (Sat, 21 Jul 2007) $
026     */
027    public class KdcOptions extends Options
028    {
029        /**
030         * KDC option - reserved.
031         */
032        public static final int RESERVED = 0;
033    
034        /**
035         * KDC option - forwardable.
036         */
037        public static final int FORWARDABLE = 1;
038    
039        /**
040         * KDC option - forwarded.
041         */
042        public static final int FORWARDED = 2;
043    
044        /**
045         * KDC option - proxiable.
046         */
047        public static final int PROXIABLE = 3;
048    
049        /**
050         * KDC option - proxy.
051         */
052        public static final int PROXY = 4;
053    
054        /**
055         * KDC option - allow postdate.
056         */
057        public static final int ALLOW_POSTDATE = 5;
058    
059        /**
060         * KDC option - postdated.
061         */
062        public static final int POSTDATED = 6;
063    
064        /**
065         * KDC option - unused7.
066         */
067        public static final int UNUSED7 = 7;
068    
069        /**
070         * KDC option - renewable.
071         */
072        public static final int RENEWABLE = 8;
073    
074        /**
075         * KDC option - unused9.
076         */
077        public static final int UNUSED9 = 9;
078    
079        /**
080         * KDC option - unused10.
081         */
082        public static final int UNUSED10 = 10;
083    
084        /**
085         * KDC option - unused11.
086         */
087        public static final int UNUSED11 = 11;
088    
089        /**
090         * KDC option - unused12.
091         */
092        public static final int UNUSED12 = 12;
093    
094        /**
095         * KDC option - unused13.
096         */
097        public static final int UNUSED13 = 13;
098    
099        /**
100         * KDC option - disable transisted checked.
101         */
102        public static final int DISABLE_TRANSISTED_CHECKED = 26;
103    
104        /**
105         * KDC option - renewable is ok.
106         */
107        public static final int RENEWABLE_OK = 27;
108    
109        /**
110         * KDC option - encrypted key in skey.
111         */
112        public static final int ENC_TKT_IN_SKEY = 28;
113    
114        /**
115         * KDC option - renew.
116         */
117        public static final int RENEW = 30;
118    
119        /**
120         * KDC option - validate.
121         */
122        public static final int VALIDATE = 31;
123    
124        /**
125         * KDC option - maximum value.
126         */
127        public static final int MAX_VALUE = 32;
128    
129    
130        /**
131         * Creates a new instance of KdcOptions.
132         */
133        public KdcOptions()
134        {
135            super( MAX_VALUE );
136        }
137    
138    
139        /**
140         * Creates a new instance of KdcOptions.
141         *
142         * @param bytes
143         */
144        public KdcOptions( byte[] bytes )
145        {
146            super( MAX_VALUE );
147            setBytes( bytes );
148        }
149    
150    
151        /**
152         * Converts the object to a printable string.
153         */
154        public String toString()
155        {
156            StringBuffer result = new StringBuffer();
157    
158            if ( get( ALLOW_POSTDATE ) )
159            {
160                result.append( "ALLOW_POSTDATE " );
161            }
162    
163            if ( get( DISABLE_TRANSISTED_CHECKED ) )
164            {
165                result.append( "DISABLE_TRANSISTED_CHECKED " );
166            }
167    
168            if ( get( ENC_TKT_IN_SKEY ) )
169            {
170                result.append( "ENC_TKT_IN_SKEY " );
171            }
172    
173            if ( get( FORWARDABLE ) )
174            {
175                result.append( "FORWARDABLE " );
176            }
177    
178            if ( get( FORWARDED ) )
179            {
180                result.append( "FORWARDED " );
181            }
182    
183            if ( get( POSTDATED ) )
184            {
185                result.append( "POSTDATED " );
186            }
187    
188            if ( get( PROXIABLE ) )
189            {
190                result.append( "PROXIABLE " );
191            }
192    
193            if ( get( PROXY ) )
194            {
195                result.append( "PROXY " );
196            }
197    
198            if ( get( RENEW ) )
199            {
200                result.append( "RENEW " );
201            }
202    
203            if ( get( RENEWABLE ) )
204            {
205                result.append( "RENEWABLE " );
206            }
207    
208            if ( get( RENEWABLE_OK ) )
209            {
210                result.append( "RENEWABLE_OK " );
211            }
212    
213            if ( get( RESERVED ) )
214            {
215                result.append( "RESERVED " );
216            }
217    
218            if ( get( VALIDATE ) )
219            {
220                result.append( "VALIDATE " );
221            }
222    
223            return result.toString().trim();
224        }
225    }