View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License.
18   *
19   */
20  package org.apache.directory.shared.kerberos.codec.options;
21  
22  
23  /**
24   * The list of possible KDC options.
25   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
26   */
27  public class KdcOptions extends Options
28  {
29      /**
30       * KDC option - reserved for future use.
31       */
32      public static final int RESERVED_0 = 0;
33  
34      /**
35       * KDC option - forwardable.
36       */
37      public static final int FORWARDABLE = 1;
38  
39      /**
40       * KDC option - forwarded.
41       */
42      public static final int FORWARDED = 2;
43  
44      /**
45       * KDC option - proxiable.
46       */
47      public static final int PROXIABLE = 3;
48  
49      /**
50       * KDC option - proxy.
51       */
52      public static final int PROXY = 4;
53  
54      /**
55       * KDC option - allow postdate.
56       */
57      public static final int ALLOW_POSTDATE = 5;
58  
59      /**
60       * KDC option - postdated.
61       */
62      public static final int POSTDATED = 6;
63  
64      /**
65       * KDC option - reserved for future use.
66       */
67      public static final int RESERVED_7 = 7;
68  
69      /**
70       * KDC option - renewable.
71       */
72      public static final int RENEWABLE = 8;
73  
74      /**
75       * KDC option - reserved for future use.
76       */
77      public static final int RESERVED_9 = 9;
78  
79      /**
80       * KDC option - reserved for future use.
81       */
82      public static final int RESERVED_10 = 10;
83  
84      /**
85       * KDC option - reserved for future use.
86       */
87      public static final int RESERVED_11 = 11;
88  
89      /**
90       * KDC option - reserved for future use.
91       */
92      public static final int RESERVED_12 = 12;
93  
94      /**
95       * KDC option - reserved for future use.
96       */
97      public static final int RESERVED_13 = 13;
98  
99      /**
100      * KDC option - reserved for future use.
101      */
102     public static final int RESERVED_14 = 14;
103 
104     /**
105      * KDC option - reserved for future use.
106      */
107     public static final int RESERVED_15 = 15;
108 
109     /**
110      * KDC option - reserved for future use.
111      */
112     public static final int RESERVED_16 = 16;
113 
114     /**
115      * KDC option - reserved for future use.
116      */
117     public static final int RESERVED_17 = 17;
118 
119     /**
120      * KDC option - reserved for future use.
121      */
122     public static final int RESERVED_18 = 18;
123 
124     /**
125      * KDC option - reserved for future use.
126      */
127     public static final int RESERVED_19 = 19;
128 
129     /**
130      * KDC option - reserved for future use.
131      */
132     public static final int RESERVED_20 = 20;
133 
134     /**
135      * KDC option - reserved for future use.
136      */
137     public static final int RESERVED_21 = 21;
138 
139     /**
140      * KDC option - reserved for future use.
141      */
142     public static final int RESERVED_22 = 22;
143 
144     /**
145      * KDC option - reserved for future use.
146      */
147     public static final int RESERVED_23 = 23;
148 
149     /**
150      * KDC option - reserved for future use.
151      */
152     public static final int RESERVED_24 = 24;
153 
154     /**
155      * KDC option - reserved for future use.
156      */
157     public static final int RESERVED_25 = 25;
158 
159     /**
160      * KDC option - disable transisted checked.
161      */
162     public static final int DISABLE_TRANSISTED_CHECKED = 26;
163 
164     /**
165      * KDC option - renewable is ok.
166      */
167     public static final int RENEWABLE_OK = 27;
168 
169     /**
170      * KDC option - encrypted key in skey.
171      */
172     public static final int ENC_TKT_IN_SKEY = 28;
173 
174     /**
175      * KDC option - reserved for future use.
176      */
177     public static final int RESERVED_29 = 29;
178 
179     /**
180      * KDC option - renew.
181      */
182     public static final int RENEW = 30;
183 
184     /**
185      * KDC option - validate.
186      */
187     public static final int VALIDATE = 31;
188 
189     /**
190      * KDC option - maximum value.
191      */
192     public static final int MAX_VALUE = 32;
193 
194 
195     /**
196      * Creates a new instance of KdcOptions.
197      */
198     public KdcOptions()
199     {
200         super( MAX_VALUE );
201     }
202 
203 
204     /**
205      * Creates a new instance of KdcOptions.
206      *
207      * @param bytes The list of all the bits as a byte[]
208      */
209     public KdcOptions( byte[] bytes )
210     {
211         super( MAX_VALUE );
212         setBytes( bytes );
213     }
214 
215 
216     /**
217      * Converts the object to a printable string.
218      */
219     @Override
220     public String toString()
221     {
222         StringBuilder result = new StringBuilder();
223 
224         // 0
225         if ( get( RESERVED_0 ) )
226         {
227             result.append( "RESERVED_0 " );
228         }
229 
230         // 1
231         if ( get( FORWARDABLE ) )
232         {
233             result.append( "FORWARDABLE " );
234         }
235 
236         // 2
237         if ( get( FORWARDED ) )
238         {
239             result.append( "FORWARDED " );
240         }
241 
242         // 3
243         if ( get( PROXIABLE ) )
244         {
245             result.append( "PROXIABLE " );
246         }
247 
248         // 4
249         if ( get( PROXY ) )
250         {
251             result.append( "PROXY " );
252         }
253 
254         // 5
255         if ( get( ALLOW_POSTDATE ) )
256         {
257             result.append( "ALLOW_POSTDATE " );
258         }
259 
260         // 6
261         if ( get( POSTDATED ) )
262         {
263             result.append( "POSTDATED " );
264         }
265 
266         // 7
267         if ( get( RESERVED_7 ) )
268         {
269             result.append( "RESERVED_7 " );
270         }
271 
272         // 8
273         if ( get( RENEWABLE ) )
274         {
275             result.append( "RENEWABLE " );
276         }
277 
278         // 9
279         if ( get( RESERVED_9 ) )
280         {
281             result.append( "RESERVED_9 " );
282         }
283 
284         // 10
285         if ( get( RESERVED_10 ) )
286         {
287             result.append( "RESERVED_10 " );
288         }
289 
290         // 11
291         if ( get( RESERVED_11 ) )
292         {
293             result.append( "RESERVED_11 " );
294         }
295 
296         // 12
297         if ( get( RESERVED_12 ) )
298         {
299             result.append( "RESERVED_12 " );
300         }
301 
302         // 13
303         if ( get( RESERVED_13 ) )
304         {
305             result.append( "RESERVED_13 " );
306         }
307 
308         // 14
309         if ( get( RESERVED_14 ) )
310         {
311             result.append( "RESERVED_14 " );
312         }
313 
314         // 15
315         if ( get( RESERVED_15 ) )
316         {
317             result.append( "RESERVED_15 " );
318         }
319 
320         // 16
321         if ( get( RESERVED_16 ) )
322         {
323             result.append( "RESERVED_16 " );
324         }
325 
326         // 17
327         if ( get( RESERVED_17 ) )
328         {
329             result.append( "RESERVED_17 " );
330         }
331 
332         // 18
333         if ( get( RESERVED_18 ) )
334         {
335             result.append( "RESERVED_18 " );
336         }
337 
338         // 19
339         if ( get( RESERVED_19 ) )
340         {
341             result.append( "RESERVED_19 " );
342         }
343 
344         // 20
345         if ( get( RESERVED_20 ) )
346         {
347             result.append( "RESERVED_20 " );
348         }
349 
350         // 21
351         if ( get( RESERVED_21 ) )
352         {
353             result.append( "RESERVED_21 " );
354         }
355 
356         // 22
357         if ( get( RESERVED_22 ) )
358         {
359             result.append( "RESERVED_22 " );
360         }
361 
362         // 23
363         if ( get( RESERVED_23 ) )
364         {
365             result.append( "RESERVED_23 " );
366         }
367 
368         // 24
369         if ( get( RESERVED_24 ) )
370         {
371             result.append( "RESERVED_24 " );
372         }
373 
374         // 25
375         if ( get( RESERVED_25 ) )
376         {
377             result.append( "RESERVED_25 " );
378         }
379 
380         // 26
381         if ( get( DISABLE_TRANSISTED_CHECKED ) )
382         {
383             result.append( "DISABLE_TRANSISTED_CHECKED " );
384         }
385 
386         // 27
387         if ( get( RENEWABLE_OK ) )
388         {
389             result.append( "RENEWABLE_OK " );
390         }
391 
392         // 28
393         if ( get( ENC_TKT_IN_SKEY ) )
394         {
395             result.append( "ENC_TKT_IN_SKEY " );
396         }
397 
398         // 29
399         if ( get( RESERVED_29 ) )
400         {
401             result.append( "RESERVED_29 " );
402         }
403 
404         // 30
405         if ( get( RENEW ) )
406         {
407             result.append( "RENEW " );
408         }
409 
410         // 31
411         if ( get( VALIDATE ) )
412         {
413             result.append( "VALIDATE " );
414         }
415 
416         return result.toString().trim();
417     }
418 }