author | stefank |
Mon, 04 Apr 2016 09:15:01 +0200 | |
changeset 37241 | b9961c99c356 |
parent 31474 | 7b79555b8073 |
permissions | -rw-r--r-- |
16065
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
1 |
/* |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
4 |
* |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
8 |
* |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
13 |
* accompanied this code). |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
14 |
* |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
18 |
* |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
21 |
* questions. |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
22 |
*/ |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
23 |
|
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
24 |
/* |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
25 |
* @test |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
26 |
* @bug 8000653 |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
27 |
* @summary SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid) |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
28 |
* @compile -XDignore.symbol.file SpnegoLifeTime.java |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
29 |
* @run main/othervm SpnegoLifeTime |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
30 |
*/ |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
31 |
|
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
32 |
import org.ietf.jgss.Oid; |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
33 |
import org.ietf.jgss.GSSCredential; |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
34 |
import sun.security.jgss.GSSUtil; |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
35 |
|
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
36 |
public class SpnegoLifeTime { |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
37 |
|
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
38 |
public static void main(String[] args) throws Exception { |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
39 |
|
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
40 |
Oid oid = GSSUtil.GSS_SPNEGO_MECH_OID; |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
41 |
new OneKDC(null).writeJAASConf(); |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
42 |
|
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
43 |
Context c, s; |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
44 |
c = Context.fromJAAS("client"); |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
45 |
s = Context.fromJAAS("server"); |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
46 |
|
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
47 |
c.startAsClient(OneKDC.SERVER, oid); |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
48 |
c.x().requestCredDeleg(true); |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
49 |
s.startAsServer(oid); |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
50 |
|
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
51 |
Context.handshake(c, s); |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
52 |
|
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
53 |
GSSCredential cred = s.delegated().cred(); |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
54 |
cred.getRemainingInitLifetime(oid); |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
55 |
cred.getUsage(oid); |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
56 |
} |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
57 |
} |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
diff
changeset
|
58 |