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.server.kerberos.shared.messages.value;
21
22
23 /**
24 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
25 * @version $Rev: 558293 $, $Date: 2007-07-21 12:51:06 +0200 (Sa, 21 Jul 2007) $
26 */
27 public class KdcOptions extends Options
28 {
29 /**
30 * KDC option - reserved.
31 */
32 public static final int RESERVED = 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 - unused7.
66 */
67 public static final int UNUSED7 = 7;
68
69 /**
70 * KDC option - renewable.
71 */
72 public static final int RENEWABLE = 8;
73
74 /**
75 * KDC option - unused9.
76 */
77 public static final int UNUSED9 = 9;
78
79 /**
80 * KDC option - unused10.
81 */
82 public static final int UNUSED10 = 10;
83
84 /**
85 * KDC option - unused11.
86 */
87 public static final int UNUSED11 = 11;
88
89 /**
90 * KDC option - unused12.
91 */
92 public static final int UNUSED12 = 12;
93
94 /**
95 * KDC option - unused13.
96 */
97 public static final int UNUSED13 = 13;
98
99 /**
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 }