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;
021
022
023 import javax.security.auth.kerberos.KerberosPrincipal;
024
025 import org.apache.directory.server.kerberos.shared.KerberosMessageType;
026 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
027
028
029 /**
030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
031 * @version $Rev: 589780 $, $Date: 2007-10-29 20:14:59 +0200 (Mon, 29 Oct 2007) $
032 */
033 public class ErrorMessage extends KerberosMessage
034 {
035 private KerberosTime clientTime; //optional
036 private Integer clientMicroSecond; //optional
037 private KerberosTime serverTime;
038 private int serverMicroSecond;
039 private int errorCode;
040 private KerberosPrincipal clientPrincipal; //optional
041 private KerberosPrincipal serverPrincipal;
042 private String explanatoryText; //optional
043 private byte[] explanatoryData; //optional
044
045
046 /**
047 * Creates a new instance of ErrorMessage.
048 *
049 * @param clientTime
050 * @param clientMicroSecond
051 * @param serverTime
052 * @param serverMicroSecond
053 * @param errorCode
054 * @param clientPrincipal
055 * @param serverPrincipal
056 * @param explanatoryText
057 * @param explanatoryData
058 */
059 public ErrorMessage( KerberosTime clientTime, Integer clientMicroSecond, KerberosTime serverTime,
060 int serverMicroSecond, int errorCode, KerberosPrincipal clientPrincipal, KerberosPrincipal serverPrincipal,
061 String explanatoryText, byte[] explanatoryData )
062 {
063 super( KerberosMessageType.KRB_ERROR );
064
065 this.clientTime = clientTime;
066 this.clientMicroSecond = clientMicroSecond;
067 this.serverTime = serverTime;
068 this.serverMicroSecond = serverMicroSecond;
069 this.errorCode = errorCode;
070 this.clientPrincipal = clientPrincipal;
071 this.serverPrincipal = serverPrincipal;
072 this.explanatoryText = explanatoryText;
073 this.explanatoryData = explanatoryData;
074 }
075
076
077 /**
078 * Returns the client {@link KerberosPrincipal}.
079 *
080 * @return The client {@link KerberosPrincipal}.
081 */
082 public KerberosPrincipal getClientPrincipal()
083 {
084 return clientPrincipal;
085 }
086
087
088 /**
089 * Returns the client {@link KerberosTime}.
090 *
091 * @return The client {@link KerberosTime}.
092 */
093 public KerberosTime getClientTime()
094 {
095 return clientTime;
096 }
097
098
099 /**
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 }