3054N/A/*
3579N/A * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
3054N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3054N/A *
3054N/A * This code is free software; you can redistribute it and/or modify it
3054N/A * under the terms of the GNU General Public License version 2 only, as
3054N/A * published by the Free Software Foundation.
3054N/A *
3054N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3054N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3054N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3054N/A * version 2 for more details (a copy is included in the LICENSE file that
3054N/A * accompanied this code).
3054N/A *
3054N/A * You should have received a copy of the GNU General Public License version
3054N/A * 2 along with this work; if not, write to the Free Software Foundation,
3054N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3054N/A *
3054N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3054N/A * or visit www.oracle.com if you need additional information or have any
3054N/A * questions.
3054N/A */
3054N/A
3054N/A/*
3054N/A * @test
3054N/A * @bug 6960894
3054N/A * @summary Better AS-REQ creation and processing
3579N/A * @run main/othervm NewSalt
3054N/A * @run main/othervm -Dnopreauth NewSalt
3054N/A * @run main/othervm -Donlyonepreauth NewSalt
3054N/A */
3054N/A
3054N/Aimport sun.security.jgss.GSSUtil;
3054N/Aimport sun.security.krb5.Config;
3054N/A
3054N/Apublic class NewSalt {
3054N/A
3054N/A public static void main(String[] args)
3054N/A throws Exception {
3054N/A
3054N/A // Create and start the KDC
3054N/A KDC kdc = new OneKDC(null);
3054N/A if (System.getProperty("onlyonepreauth") != null) {
3054N/A KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
3054N/A "default_tgs_enctypes=des3-cbc-sha1");
3054N/A Config.refresh();
3054N/A kdc.setOption(KDC.Option.ONLY_ONE_PREAUTH, true);
3054N/A }
3054N/A if (System.getProperty("nopreauth") != null) {
3054N/A kdc.setOption(KDC.Option.PREAUTH_REQUIRED, false);
3054N/A }
3054N/A
3054N/A // Use a different case of name. KDC will return correct salt
3054N/A Context c1 = Context.fromUserPass(OneKDC.USER.toUpperCase(),
3054N/A OneKDC.PASS, true);
3054N/A Context c2 = Context.fromUserPass(OneKDC.USER2.toUpperCase(),
3054N/A OneKDC.PASS2, true);
3054N/A
3054N/A c1.startAsClient(OneKDC.USER2, GSSUtil.GSS_KRB5_MECH_OID);
3054N/A c2.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
3054N/A
3054N/A Context.handshake(c1, c2);
3054N/A }
3054N/A}