author | stefank |
Mon, 25 Aug 2014 09:10:13 +0200 | |
changeset 26314 | f8bc1966fb30 |
parent 10141 | 664ba64d2472 |
child 30820 | 0d4717a011d3 |
permissions | -rw-r--r-- |
10141
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
1 |
/* |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
2 |
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
4 |
* |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
8 |
* |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
13 |
* accompanied this code). |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
14 |
* |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
18 |
* |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
21 |
* questions. |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
22 |
*/ |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
23 |
|
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
24 |
/* |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
25 |
* @test |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
26 |
* @bug 7061379 |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
27 |
* @summary [Kerberos] Cross-realm authentication fails, due to nameType problem |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
28 |
* @compile -XDignore.symbol.file PrincipalNameEquals.java |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
29 |
* @run main/othervm PrincipalNameEquals |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
30 |
*/ |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
31 |
|
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
32 |
import sun.security.jgss.GSSUtil; |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
33 |
import sun.security.krb5.PrincipalName; |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
34 |
|
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
35 |
public class PrincipalNameEquals { |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
36 |
|
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
37 |
public static void main(String[] args) throws Exception { |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
38 |
|
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
39 |
OneKDC kdc = new OneKDC(null); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
40 |
kdc.writeJAASConf(); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
41 |
kdc.setOption(KDC.Option.RESP_NT, PrincipalName.KRB_NT_PRINCIPAL); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
42 |
|
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
43 |
Context c, s; |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
44 |
c = Context.fromJAAS("client"); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
45 |
s = Context.fromJAAS("server"); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
46 |
|
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
47 |
c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
48 |
s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
49 |
|
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
50 |
Context.handshake(c, s); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
51 |
|
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
52 |
Context.transmit("i say high --", c, s); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
53 |
Context.transmit(" you say low", s, c); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
54 |
|
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
55 |
s.dispose(); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
56 |
c.dispose(); |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
57 |
} |
664ba64d2472
7061379: [Kerberos] Cross-realm authentication fails, due to nameType problem
weijun
parents:
diff
changeset
|
58 |
} |