1 /* |
1 /* |
2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
|
24 /* |
|
25 * @test |
|
26 * @bug 6853328 7172701 |
|
27 * @run main/othervm OkAsDelegate false true true false false false |
|
28 * FORWARDABLE ticket not allowed, always fail |
|
29 * @run main/othervm OkAsDelegate true false false false false false |
|
30 * Service ticket no OK-AS-DELEGATE. Request nothing, gain nothing |
|
31 * @run main/othervm OkAsDelegate true false true false false false |
|
32 * Service ticket no OK-AS-DELEGATE. Request deleg policy, gain nothing |
|
33 * @run main/othervm OkAsDelegate true true false true false true |
|
34 * Service ticket no OK-AS-DELEGATE. Request deleg, granted |
|
35 * @run main/othervm OkAsDelegate true true true true false true |
|
36 * Service ticket no OK-AS-DELEGATE. Request deleg and deleg policy, granted, with info not by policy |
|
37 * @run main/othervm -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true false true true true true |
|
38 * Service ticket has OK-AS-DELEGATE. Request deleg policy, granted |
|
39 * @run main/othervm -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true true true true true true |
|
40 * Service ticket has OK-AS-DELEGATE. granted, with info by policy |
|
41 * @run main/othervm -Dtest.spnego OkAsDelegate false true true false false false |
|
42 * @run main/othervm -Dtest.spnego OkAsDelegate true false false false false false |
|
43 * @run main/othervm -Dtest.spnego OkAsDelegate true false true false false false |
|
44 * @run main/othervm -Dtest.spnego OkAsDelegate true true false true false true |
|
45 * @run main/othervm -Dtest.spnego OkAsDelegate true true true true false true |
|
46 * @run main/othervm -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true false true true true true |
|
47 * @run main/othervm -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true true true true true true |
|
48 * @summary Support OK-AS-DELEGATE flag |
|
49 */ |
24 import com.sun.security.jgss.ExtendedGSSContext; |
50 import com.sun.security.jgss.ExtendedGSSContext; |
25 import org.ietf.jgss.GSSCredential; |
51 import org.ietf.jgss.GSSCredential; |
26 import org.ietf.jgss.GSSException; |
52 import org.ietf.jgss.GSSException; |
27 import org.ietf.jgss.Oid; |
53 import org.ietf.jgss.Oid; |
28 import sun.security.jgss.GSSUtil; |
54 import sun.security.jgss.GSSUtil; |
50 boolean delegState, |
76 boolean delegState, |
51 boolean delegPolicyState, |
77 boolean delegPolicyState, |
52 boolean delegated |
78 boolean delegated |
53 ) throws Exception { |
79 ) throws Exception { |
54 OneKDC kdc = new OneKDC(null); |
80 OneKDC kdc = new OneKDC(null); |
55 kdc.setPolicy("ok-as-delegate", |
81 kdc.setOption(KDC.Option.OK_AS_DELEGATE, |
56 System.getProperty("test.kdc.policy.ok-as-delegate")); |
82 System.getProperty("test.kdc.policy.ok-as-delegate")); |
57 kdc.writeJAASConf(); |
83 kdc.writeJAASConf(); |
58 if (!forwardable) { |
84 if (!forwardable) { |
59 // The default OneKDC always includes "forwardable = true" |
85 // The default OneKDC always includes "forwardable = true" |
60 // in krb5.conf, override it. |
86 // in krb5.conf, override it. |