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