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;
21
22
23 import javax.security.auth.kerberos.KerberosPrincipal;
24
25 import org.apache.directory.server.kerberos.shared.KerberosMessageType;
26 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
27
28
29 /**
30 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
31 * @version $Rev: 589780 $, $Date: 2007-10-29 19:14:59 +0100 (Mo, 29 Okt 2007) $
32 */
33 public class ErrorMessage extends KerberosMessage
34 {
35 private KerberosTime clientTime; //optional
36 private Integer clientMicroSecond; //optional
37 private KerberosTime serverTime;
38 private int serverMicroSecond;
39 private int errorCode;
40 private KerberosPrincipal clientPrincipal; //optional
41 private KerberosPrincipal serverPrincipal;
42 private String explanatoryText; //optional
43 private byte[] explanatoryData; //optional
44
45
46 /**
47 * Creates a new instance of ErrorMessage.
48 *
49 * @param clientTime
50 * @param clientMicroSecond
51 * @param serverTime
52 * @param serverMicroSecond
53 * @param errorCode
54 * @param clientPrincipal
55 * @param serverPrincipal
56 * @param explanatoryText
57 * @param explanatoryData
58 */
59 public ErrorMessage( KerberosTime clientTime, Integer clientMicroSecond, KerberosTime serverTime,
60 int serverMicroSecond, int errorCode, KerberosPrincipal clientPrincipal, KerberosPrincipal serverPrincipal,
61 String explanatoryText, byte[] explanatoryData )
62 {
63 super( KerberosMessageType.KRB_ERROR );
64
65 this.clientTime = clientTime;
66 this.clientMicroSecond = clientMicroSecond;
67 this.serverTime = serverTime;
68 this.serverMicroSecond = serverMicroSecond;
69 this.errorCode = errorCode;
70 this.clientPrincipal = clientPrincipal;
71 this.serverPrincipal = serverPrincipal;
72 this.explanatoryText = explanatoryText;
73 this.explanatoryData = explanatoryData;
74 }
75
76
77 /**
78 * Returns the client {@link KerberosPrincipal}.
79 *
80 * @return The client {@link KerberosPrincipal}.
81 */
82 public KerberosPrincipal getClientPrincipal()
83 {
84 return clientPrincipal;
85 }
86
87
88 /**
89 * Returns the client {@link KerberosTime}.
90 *
91 * @return The client {@link KerberosTime}.
92 */
93 public KerberosTime getClientTime()
94 {
95 return clientTime;
96 }
97
98
99 /**
100 * Returns the client microsecond.
101 *
102 * @return The client microsecond.
103 */
104 public Integer getClientMicroSecond()
105 {
106 return clientMicroSecond;
107 }
108
109
110 /**
111 * Returns the explanatory data.
112 *
113 * @return The explanatory data.
114 */
115 public byte[] getExplanatoryData()
116 {
117 return explanatoryData;
118 }
119
120
121 /**
122 * Returns the error code.
123 *
124 * @return The error code.
125 */
126 public int getErrorCode()
127 {
128 return errorCode;
129 }
130
131
132 /**
133 * Returns the explanatory text.
134 *
135 * @return The explanatory text.
136 */
137 public String getExplanatoryText()
138 {
139 return explanatoryText;
140 }
141
142
143 /**
144 * Returns the server {@link KerberosPrincipal}.
145 *
146 * @return The server {@link KerberosPrincipal}.
147 */
148 public KerberosPrincipal getServerPrincipal()
149 {
150 return serverPrincipal;
151 }
152
153
154 /**
155 * Returns the server {@link KerberosTime}.
156 *
157 * @return The server {@link KerberosTime}.
158 */
159 public KerberosTime getServerTime()
160 {
161 return serverTime;
162 }
163
164
165 /**
166 * Returns the server microsecond.
167 *
168 * @return The server microsecond.
169 */
170 public int getServerMicroSecond()
171 {
172 return serverMicroSecond;
173 }
174 }