test/jdk/sun/security/krb5/auto/BasicKrb5Test.java
author ssahoo
Thu, 25 Jan 2018 05:57:22 -0800
changeset 48668 2da4a52715d8
parent 48651 67abfee27e69
child 50187 261d0ac3b09d
permissions -rw-r--r--
8194486: Several krb5 tests failed in Mac. Summary: Several tests failed due to improper host service Reviewed-by: weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
     1
/*
48668
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
     2
 * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
     4
 *
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
     8
 *
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    13
 * accompanied this code).
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    14
 *
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1456
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1456
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1456
diff changeset
    21
 * questions.
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    22
 */
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    23
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    24
/*
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    25
 * @test
48668
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    26
 * @bug 6706974 8014628 8194486
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    27
 * @summary Add krb5 test infrastructure
48668
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    28
 * @library /test/lib
14327
c0d86f6f8be8 7184246: Simplify Config.get() of krb5
weijun
parents: 7801
diff changeset
    29
 * @compile -XDignore.symbol.file BasicKrb5Test.java
48668
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    30
 * @run main jdk.test.lib.FileInstaller TestHosts TestHosts
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    31
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    32
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-crc
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    33
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-md5
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    34
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des3-cbc-sha1
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    35
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha1
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    36
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha1
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    37
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha2
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    38
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha2
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    39
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test rc4-hmac
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    40
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test -s
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    41
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-crc -s
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    42
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-md5 -s
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    43
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    44
 *                   des3-cbc-sha1 -s
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    45
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha1 -s
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    46
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha1 -s
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    47
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha2 -s
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    48
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha2 -s
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    49
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test rc4-hmac -s
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    50
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    51
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-crc -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    52
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-md5 -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    53
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    54
 *                   des3-cbc-sha1 -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    55
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha1 -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    56
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha1 -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    57
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha2 -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    58
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha2 -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    59
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test rc4-hmac -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    60
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test -s -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    61
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    62
 *                   des-cbc-crc -s -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    63
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    64
 *                   des-cbc-md5 -s -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    65
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    66
 *                   des3-cbc-sha1 -s -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    67
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    68
 *                   aes128-sha1 -s -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    69
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    70
 *                   aes256-sha1 -s -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    71
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    72
 *                   aes128-sha2 -s -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    73
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    74
 *                   aes256-sha2 -s -C
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    75
 * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test
2da4a52715d8 8194486: Several krb5 tests failed in Mac.
ssahoo
parents: 48651
diff changeset
    76
 *                   rc4-hmac -s -C
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    77
 */
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    78
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    79
import org.ietf.jgss.GSSName;
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    80
import sun.security.jgss.GSSUtil;
18168
f47169155ea0 8014310: JAAS/Krb5LoginModule using des encytypes failure with NPE after JDK-8012679
weijun
parents: 14342
diff changeset
    81
import sun.security.krb5.KrbException;
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    82
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    83
/**
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    84
 * Basic JGSS/krb5 test with 3 parties: client, server, backend server. Each
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    85
 * party uses JAAS login to get subjects and executes JGSS calls using
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    86
 * Subject.doAs.
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    87
 */
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    88
public class BasicKrb5Test {
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    89
7801
814c8359b104 6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents: 5506
diff changeset
    90
    private static boolean conf = true;
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    91
    /**
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    92
     * @param args empty or etype
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    93
     */
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    94
    public static void main(String[] args)
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    95
            throws Exception {
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    96
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
    97
        String etype = null;
7801
814c8359b104 6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents: 5506
diff changeset
    98
        for (String arg: args) {
814c8359b104 6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents: 5506
diff changeset
    99
            if (arg.equals("-s")) Context.usingStream = true;
814c8359b104 6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents: 5506
diff changeset
   100
            else if(arg.equals("-C")) conf = false;
814c8359b104 6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents: 5506
diff changeset
   101
            else etype = arg;
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   102
        }
1456
1d3c6724de2f 6761072: new krb5 tests fail on multiple platforms
weijun
parents: 1454
diff changeset
   103
1d3c6724de2f 6761072: new krb5 tests fail on multiple platforms
weijun
parents: 1454
diff changeset
   104
        // Creates and starts the KDC. This line must be put ahead of etype check
1d3c6724de2f 6761072: new krb5 tests fail on multiple platforms
weijun
parents: 1454
diff changeset
   105
        // since the check needs a krb5.conf.
18168
f47169155ea0 8014310: JAAS/Krb5LoginModule using des encytypes failure with NPE after JDK-8012679
weijun
parents: 14342
diff changeset
   106
        try {
f47169155ea0 8014310: JAAS/Krb5LoginModule using des encytypes failure with NPE after JDK-8012679
weijun
parents: 14342
diff changeset
   107
            new OneKDC(etype).writeJAASConf();
f47169155ea0 8014310: JAAS/Krb5LoginModule using des encytypes failure with NPE after JDK-8012679
weijun
parents: 14342
diff changeset
   108
        } catch (KrbException ke) {
f47169155ea0 8014310: JAAS/Krb5LoginModule using des encytypes failure with NPE after JDK-8012679
weijun
parents: 14342
diff changeset
   109
            System.out.println("Testing etype " + etype + "Not supported.");
7801
814c8359b104 6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents: 5506
diff changeset
   110
            return;
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   111
        }
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   112
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   113
        new BasicKrb5Test().go(OneKDC.SERVER, OneKDC.BACKEND);
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   114
    }
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   115
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   116
    void go(final String server, final String backend) throws Exception {
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   117
        Context c, s, s2, b;
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   118
        c = Context.fromJAAS("client");
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   119
        s = Context.fromJAAS("server");
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   120
        b = Context.fromJAAS("backend");
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   121
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   122
        c.startAsClient(server, GSSUtil.GSS_KRB5_MECH_OID);
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   123
        c.x().requestCredDeleg(true);
7801
814c8359b104 6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents: 5506
diff changeset
   124
        c.x().requestConf(conf);
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   125
        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   126
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   127
        c.status();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   128
        s.status();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   129
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   130
        Context.handshake(c, s);
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   131
        GSSName client = c.x().getSrcName();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   132
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   133
        c.status();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   134
        s.status();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   135
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   136
        Context.transmit("i say high --", c, s);
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   137
        Context.transmit("   you say low", s, c);
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   138
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   139
        s2 = s.delegated();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   140
        s.dispose();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   141
        s = null;
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   142
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   143
        s2.startAsClient(backend, GSSUtil.GSS_KRB5_MECH_OID);
7801
814c8359b104 6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents: 5506
diff changeset
   144
        s2.x().requestConf(conf);
1454
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   145
        b.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   146
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   147
        s2.status();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   148
        b.status();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   149
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   150
        Context.handshake(s2, b);
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   151
        GSSName client2 = b.x().getSrcName();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   152
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   153
        if (!client.equals(client2)) {
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   154
            throw new Exception("Delegation failed");
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   155
        }
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   156
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   157
        s2.status();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   158
        b.status();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   159
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   160
        Context.transmit("you say hello --", s2, b);
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   161
        Context.transmit("   i say goodbye", b, s2);
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   162
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   163
        s2.dispose();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   164
        b.dispose();
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   165
    }
d9b6f1de641f 6706974: Add krb5 test infrastructure
weijun
parents:
diff changeset
   166
}