author | chegar |
Sun, 17 Aug 2014 15:54:13 +0100 | |
changeset 25859 | 3317bb8137f4 |
parent 25661 | jdk/src/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java@929c829a8400 |
child 27771 | 360714d431ab |
permissions | -rw-r--r-- |
25661
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
1 |
/* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
4 |
* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
10 |
* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
15 |
* accompanied this code). |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
16 |
* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
20 |
* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
23 |
* questions. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
24 |
*/ |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
25 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
26 |
package javax.security.auth.kerberos; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
27 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
28 |
import javax.security.auth.Destroyable; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
29 |
import java.util.Arrays; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
30 |
import java.util.Base64; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
31 |
import java.util.Objects; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
32 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
33 |
/** |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
34 |
* This class encapsulates a Kerberos 5 KRB_CRED message which can be used to |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
35 |
* send Kerberos credentials from one principal to another.<p> |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
36 |
* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
37 |
* A KRB_CRED message is defined in Section 5.8.1 of the Kerberos Protocol |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
38 |
* Specification (<a href=http://www.ietf.org/rfc/rfc4120.txt>RFC 4120</a>) as: |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
39 |
* <pre> |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
40 |
* KRB-CRED ::= [APPLICATION 22] SEQUENCE { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
41 |
* pvno [0] INTEGER (5), |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
42 |
* msg-type [1] INTEGER (22), |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
43 |
* tickets [2] SEQUENCE OF Ticket, |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
44 |
* enc-part [3] EncryptedData -- EncKrbCredPart |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
45 |
* } |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
46 |
* </pre><p> |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
47 |
* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
48 |
* @since 1.9 |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
49 |
*/ |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
50 |
public final class KerberosCredMessage implements Destroyable { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
51 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
52 |
final private KerberosPrincipal sender; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
53 |
final private KerberosPrincipal recipient; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
54 |
final private byte[] message; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
55 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
56 |
private boolean destroyed = false; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
57 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
58 |
/** |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
59 |
* Constructs a {@code KerberosCredMessage} object. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
60 |
* <p> |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
61 |
* The contents of the {@code message} argument are copied; subsequent |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
62 |
* modification of the byte array does not affect the newly created object. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
63 |
* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
64 |
* @param sender the sender of the message |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
65 |
* @param recipient the recipient of the message |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
66 |
* @param message the DER encoded KRB_CRED message |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
67 |
* @throws NullPointerException if any of sender, recipient |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
68 |
* or message is null |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
69 |
*/ |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
70 |
public KerberosCredMessage(KerberosPrincipal sender, |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
71 |
KerberosPrincipal recipient, |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
72 |
byte[] message) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
73 |
this.sender = Objects.requireNonNull(sender); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
74 |
this.recipient = Objects.requireNonNull(recipient); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
75 |
this.message = Objects.requireNonNull(message).clone(); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
76 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
77 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
78 |
/** |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
79 |
* Returns the DER encoded form of the KRB_CRED message. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
80 |
* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
81 |
* @return a newly allocated byte array that contains the encoded form |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
82 |
* @throws IllegalStateException if the object is destroyed |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
83 |
*/ |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
84 |
public byte[] getEncoded() { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
85 |
if (destroyed) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
86 |
throw new IllegalStateException("This object is no longer valid"); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
87 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
88 |
return message.clone(); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
89 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
90 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
91 |
/** |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
92 |
* Returns the sender of this message. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
93 |
* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
94 |
* @return the sender |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
95 |
* @throws IllegalStateException if the object is destroyed |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
96 |
*/ |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
97 |
public KerberosPrincipal getSender() { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
98 |
if (destroyed) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
99 |
throw new IllegalStateException("This object is no longer valid"); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
100 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
101 |
return sender; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
102 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
103 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
104 |
/** |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
105 |
* Returns the recipient of this message. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
106 |
* |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
107 |
* @return the recipient |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
108 |
* @throws IllegalStateException if the object is destroyed |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
109 |
*/ |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
110 |
public KerberosPrincipal getRecipient() { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
111 |
if (destroyed) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
112 |
throw new IllegalStateException("This object is no longer valid"); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
113 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
114 |
return recipient; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
115 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
116 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
117 |
/** |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
118 |
* Destroys this object by clearing out the message. |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
119 |
*/ |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
120 |
@Override |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
121 |
public void destroy() { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
122 |
if (!destroyed) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
123 |
Arrays.fill(message, (byte)0); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
124 |
destroyed = true; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
125 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
126 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
127 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
128 |
@Override |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
129 |
public boolean isDestroyed() { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
130 |
return destroyed; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
131 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
132 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
133 |
@Override |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
134 |
public String toString() { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
135 |
if (destroyed) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
136 |
return "Destroyed KerberosCredMessage"; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
137 |
} else { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
138 |
return "KRB_CRED from " + sender + " to " + recipient + ":\n" |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
139 |
+ Base64.getUrlEncoder().encodeToString(message); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
140 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
141 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
142 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
143 |
@Override |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
144 |
public int hashCode() { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
145 |
if (isDestroyed()) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
146 |
return -1; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
147 |
} else { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
148 |
return Objects.hash(sender, recipient, Arrays.hashCode(message)); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
149 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
150 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
151 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
152 |
@Override |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
153 |
public boolean equals(Object other) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
154 |
if (other == this) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
155 |
return true; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
156 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
157 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
158 |
if (! (other instanceof KerberosCredMessage)) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
159 |
return false; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
160 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
161 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
162 |
KerberosCredMessage otherMessage = ((KerberosCredMessage) other); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
163 |
if (isDestroyed() || otherMessage.isDestroyed()) { |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
164 |
return false; |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
165 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
166 |
|
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
167 |
return Objects.equals(sender, otherMessage.sender) |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
168 |
&& Objects.equals(recipient, otherMessage.recipient) |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
169 |
&& Arrays.equals(message, otherMessage.message); |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
170 |
} |
929c829a8400
8043071: Expose session key and KRB_CRED through extended GSS-API
weijun
parents:
diff
changeset
|
171 |
} |