jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java
author weijun
Thu, 02 Jul 2015 16:20:43 +0800
changeset 31474 7b79555b8073
parent 30820 0d4717a011d3
child 36511 9d0388c6b336
permissions -rw-r--r--
8130112: Create a common TEST.properties for @modules in test/sun/security/krb5/auto Reviewed-by: alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 16020
diff changeset
     2
 * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
     4
 *
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
     7
 * published by the Free Software Foundation.
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
     8
 *
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    13
 * accompanied this code).
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    14
 *
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5154
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5154
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5154
diff changeset
    21
 * questions.
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    22
 */
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    23
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    24
/*
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    25
 * @test
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
    26
 * @bug 6578647 6829283
8396
587947f96036 7018928: test failure: sun/security/krb5/auto/SSL.java
weijun
parents: 7977
diff changeset
    27
 * @run main/othervm HttpNegotiateServer
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    28
 * @summary Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
    29
 * @summary HTTP/Negotiate: Authenticator triggered again when user cancels the first one
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    30
 */
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    31
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    32
import com.sun.net.httpserver.Headers;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    33
import com.sun.net.httpserver.HttpContext;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    34
import com.sun.net.httpserver.HttpExchange;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    35
import com.sun.net.httpserver.HttpHandler;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    36
import com.sun.net.httpserver.HttpServer;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    37
import com.sun.net.httpserver.HttpPrincipal;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    38
import com.sun.security.auth.module.Krb5LoginModule;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    39
import java.io.BufferedReader;
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
    40
import java.io.File;
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
    41
import java.io.FileOutputStream;
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    42
import java.io.IOException;
30685
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    43
import java.io.InputStream;
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    44
import java.io.InputStreamReader;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    45
import java.net.HttpURLConnection;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    46
import java.net.InetSocketAddress;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    47
import java.net.PasswordAuthentication;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    48
import java.net.Proxy;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    49
import java.net.URL;
30685
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    50
import java.net.URLConnection;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    51
import java.security.*;
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    52
import java.util.HashMap;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    53
import java.util.Map;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    54
import javax.security.auth.Subject;
30685
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    55
import javax.security.auth.callback.Callback;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    56
import javax.security.auth.callback.CallbackHandler;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    57
import javax.security.auth.callback.NameCallback;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    58
import javax.security.auth.callback.PasswordCallback;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    59
import javax.security.auth.callback.UnsupportedCallbackException;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    60
import javax.security.auth.login.AppConfigurationEntry;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    61
import javax.security.auth.login.Configuration;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    62
import javax.security.auth.login.LoginContext;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    63
import javax.security.auth.login.LoginException;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    64
import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    65
import org.ietf.jgss.GSSContext;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    66
import org.ietf.jgss.GSSCredential;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    67
import org.ietf.jgss.GSSManager;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    68
import sun.security.jgss.GSSUtil;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    69
import sun.security.krb5.Config;
30685
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
    70
import java.util.Base64;
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    71
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    72
/**
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    73
 * Basic JGSS/krb5 test with 3 parties: client, server, backend server. Each
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    74
 * party uses JAAS login to get subjects and executes JGSS calls using
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    75
 * Subject.doAs.
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    76
 */
3046
dd50d75d88e6 6849275: enhance krb5 reg tests
weijun
parents: 2942
diff changeset
    77
public class HttpNegotiateServer {
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    78
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    79
    // Two realm, web server in one, proxy server in another
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    80
    final static String REALM_WEB = "WEB.DOMAIN";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    81
    final static String REALM_PROXY = "PROXY.DOMAIN";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    82
    final static String KRB5_CONF = "web.conf";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    83
    final static String KRB5_TAB = "web.ktab";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    84
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    85
    // user principals
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    86
    final static String WEB_USER = "web";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    87
    final static char[] WEB_PASS = "webby".toCharArray();
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    88
    final static String PROXY_USER = "pro";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    89
    final static char[] PROXY_PASS = "proxy".toCharArray();
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
    90
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    91
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    92
    final static String WEB_HOST = "host.web.domain";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    93
    final static String PROXY_HOST = "host.proxy.domain";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    94
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    95
    // web page content
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    96
    final static String CONTENT = "Hello, World!";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
    97
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
    98
    // For 6829283, count how many times the Authenticator is called.
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
    99
    static int count = 0;
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   100
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   101
    static int webPort, proxyPort;
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   102
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   103
    // URLs for web test, proxy test. The proxy server is not a real proxy
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   104
    // since it fakes the same content for any URL. :)
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   105
    static URL webUrl, proxyUrl;
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   106
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   107
    /**
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   108
     * This Authenticator checks everything:
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   109
     * scheme, protocol, requestor type, host, port, and url
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   110
     */
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   111
    static class KnowAllAuthenticator extends java.net.Authenticator {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   112
        public PasswordAuthentication getPasswordAuthentication () {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   113
            if (!getRequestingScheme().equalsIgnoreCase("Negotiate")) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   114
                throw new RuntimeException("Bad scheme");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   115
            }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   116
            if (!getRequestingProtocol().equalsIgnoreCase("HTTP")) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   117
                throw new RuntimeException("Bad protocol");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   118
            }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   119
            if (getRequestorType() == RequestorType.SERVER) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   120
                if (!this.getRequestingHost().equalsIgnoreCase(webUrl.getHost())) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   121
                    throw new RuntimeException("Bad host");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   122
                }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   123
                if (this.getRequestingPort() != webUrl.getPort()) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   124
                    throw new RuntimeException("Bad port");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   125
                }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   126
                if (!this.getRequestingURL().equals(webUrl)) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   127
                    throw new RuntimeException("Bad url");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   128
                }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   129
                return new PasswordAuthentication(
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   130
                        WEB_USER+"@"+REALM_WEB, WEB_PASS);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   131
            } else if (getRequestorType() == RequestorType.PROXY) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   132
                if (!this.getRequestingHost().equalsIgnoreCase(PROXY_HOST)) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   133
                    throw new RuntimeException("Bad host");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   134
                }
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   135
                if (this.getRequestingPort() != proxyPort) {
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   136
                    throw new RuntimeException("Bad port");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   137
                }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   138
                if (!this.getRequestingURL().equals(proxyUrl)) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   139
                    throw new RuntimeException("Bad url");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   140
                }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   141
                return new PasswordAuthentication(
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   142
                        PROXY_USER+"@"+REALM_PROXY, PROXY_PASS);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   143
            } else  {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   144
                throw new RuntimeException("Bad requster type");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   145
            }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   146
        }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   147
    }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   148
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   149
    /**
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   150
     * This Authenticator knows nothing
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   151
     */
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   152
    static class KnowNothingAuthenticator extends java.net.Authenticator {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   153
        @Override
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   154
        public PasswordAuthentication getPasswordAuthentication () {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   155
            HttpNegotiateServer.count++;
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   156
            return null;
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   157
        }
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   158
    }
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   159
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   160
    public static void main(String[] args)
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   161
            throws Exception {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   162
25151
7a670121602e 8029994: Support "include" and "includedir" in krb5.conf
weijun
parents: 23010
diff changeset
   163
        System.setProperty("sun.security.krb5.debug", "true");
7a670121602e 8029994: Support "include" and "includedir" in krb5.conf
weijun
parents: 23010
diff changeset
   164
3046
dd50d75d88e6 6849275: enhance krb5 reg tests
weijun
parents: 2942
diff changeset
   165
        KDC kdcw = KDC.create(REALM_WEB);
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   166
        kdcw.addPrincipal(WEB_USER, WEB_PASS);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   167
        kdcw.addPrincipalRandKey("krbtgt/" + REALM_WEB);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   168
        kdcw.addPrincipalRandKey("HTTP/" + WEB_HOST);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   169
3046
dd50d75d88e6 6849275: enhance krb5 reg tests
weijun
parents: 2942
diff changeset
   170
        KDC kdcp = KDC.create(REALM_PROXY);
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   171
        kdcp.addPrincipal(PROXY_USER, PROXY_PASS);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   172
        kdcp.addPrincipalRandKey("krbtgt/" + REALM_PROXY);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   173
        kdcp.addPrincipalRandKey("HTTP/" + PROXY_HOST);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   174
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   175
        KDC.saveConfig(KRB5_CONF, kdcw, kdcp,
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   176
                "default_keytab_name = " + KRB5_TAB,
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   177
                "[domain_realm]",
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   178
                "",
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   179
                ".web.domain="+REALM_WEB,
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   180
                ".proxy.domain="+REALM_PROXY);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   181
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   182
        System.setProperty("java.security.krb5.conf", KRB5_CONF);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   183
        Config.refresh();
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   184
        KDC.writeMultiKtab(KRB5_TAB, kdcw, kdcp);
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   185
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   186
        // Write a customized JAAS conf file, so that any kinit cache
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   187
        // will be ignored.
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   188
        System.setProperty("java.security.auth.login.config", OneKDC.JAAS_CONF);
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   189
        File f = new File(OneKDC.JAAS_CONF);
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   190
        FileOutputStream fos = new FileOutputStream(f);
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   191
        fos.write((
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   192
                "com.sun.security.jgss.krb5.initiate {\n" +
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   193
                "    com.sun.security.auth.module.Krb5LoginModule required;\n};\n"
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   194
                ).getBytes());
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   195
        fos.close();
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   196
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   197
        HttpServer h1 = httpd("Negotiate", false,
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   198
                "HTTP/" + WEB_HOST + "@" + REALM_WEB, KRB5_TAB);
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   199
        webPort = h1.getAddress().getPort();
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   200
        HttpServer h2 = httpd("Negotiate", true,
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   201
                "HTTP/" + PROXY_HOST + "@" + REALM_PROXY, KRB5_TAB);
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   202
        proxyPort = h2.getAddress().getPort();
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   203
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   204
        webUrl = new URL("http://" + WEB_HOST +":" + webPort + "/a/b/c");
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   205
        proxyUrl = new URL("http://nosuchplace/a/b/c");
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   206
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   207
        try {
30685
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   208
            Exception e1 = null, e2 = null, e3 = null;
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   209
            try {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   210
                test6578647();
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   211
            } catch (Exception e) {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   212
                e1 = e;
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   213
                e.printStackTrace();
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   214
            }
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   215
            try {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   216
                test6829283();
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   217
            } catch (Exception e) {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   218
                e2 = e;
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   219
                e.printStackTrace();
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   220
            }
30685
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   221
            try {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   222
                test8077155();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   223
            } catch (Exception e) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   224
                e3 = e;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   225
                e.printStackTrace();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   226
            }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   227
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   228
            if (e1 != null || e2 != null || e3 != null) {
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   229
                throw new RuntimeException("Test error");
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   230
            }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   231
        } finally {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   232
            // Must stop. Seems there's no HttpServer.startAsDaemon()
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   233
            if (h1 != null) h1.stop(0);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   234
            if (h2 != null) h2.stop(0);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   235
        }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   236
    }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   237
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   238
    static void test6578647() throws Exception {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   239
        BufferedReader reader;
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   240
        java.net.Authenticator.setDefault(new KnowAllAuthenticator());
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   241
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   242
        reader = new BufferedReader(new InputStreamReader(
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   243
                webUrl.openConnection().getInputStream()));
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   244
        if (!reader.readLine().equals(CONTENT)) {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   245
            throw new RuntimeException("Bad content");
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   246
        }
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   247
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   248
        reader = new BufferedReader(new InputStreamReader(
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   249
                proxyUrl.openConnection(
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   250
                new Proxy(Proxy.Type.HTTP,
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   251
                    new InetSocketAddress(PROXY_HOST, proxyPort)))
5154
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   252
                .getInputStream()));
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   253
        if (!reader.readLine().equals(CONTENT)) {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   254
            throw new RuntimeException("Bad content");
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   255
        }
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   256
    }
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   257
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   258
    static void test6829283() throws Exception {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   259
        BufferedReader reader;
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   260
        java.net.Authenticator.setDefault(new KnowNothingAuthenticator());
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   261
        try {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   262
            new BufferedReader(new InputStreamReader(
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   263
                    webUrl.openConnection().getInputStream()));
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   264
        } catch (IOException ioe) {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   265
            // Will fail since no username and password is provided.
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   266
        }
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   267
        if (count > 1) {
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   268
            throw new RuntimeException("Authenticator called twice");
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   269
        }
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   270
    }
07af3c279166 6829283: HTTP/Negotiate: Autheticator triggered again when user cancels the first one
weijun
parents: 4236
diff changeset
   271
30685
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   272
    static void testConnect() {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   273
        InputStream inputStream = null;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   274
        try {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   275
            URL url = webUrl;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   276
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   277
            URLConnection conn = url.openConnection();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   278
            conn.connect();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   279
            inputStream = conn.getInputStream();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   280
            byte[] b = new byte[inputStream.available()];
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   281
            for (int j = 0; j < b.length; j++) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   282
                b[j] = (byte) inputStream.read();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   283
            }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   284
            String s = new String(b);
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   285
            System.out.println("Length: " + s.length());
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   286
            System.out.println(s);
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   287
        } catch (Exception ex) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   288
              throw new RuntimeException(ex);
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   289
        } finally {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   290
            if (inputStream != null) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   291
                try {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   292
                    inputStream.close();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   293
                } catch (IOException e) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   294
                    e.printStackTrace();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   295
                }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   296
            }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   297
        }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   298
    }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   299
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   300
    static void test8077155() throws Exception {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   301
        final String username = WEB_USER;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   302
        final char[] password = WEB_PASS;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   303
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   304
        SecurityManager security = new SecurityManager();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   305
        Policy.setPolicy(new SecurityPolicy());
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   306
        System.setSecurityManager(security);
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   307
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   308
        CallbackHandler callback = new CallbackHandler() {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   309
            @Override
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   310
            public void handle(Callback[] pCallbacks) throws IOException, UnsupportedCallbackException {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   311
                for (Callback cb : pCallbacks) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   312
                    if (cb instanceof NameCallback) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   313
                        NameCallback ncb = (NameCallback)cb;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   314
                        ncb.setName(username);
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   315
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   316
                    } else  if (cb instanceof PasswordCallback) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   317
                        PasswordCallback pwdcb = (PasswordCallback) cb;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   318
                        pwdcb.setPassword(password);
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   319
                    }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   320
                }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   321
            }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   322
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   323
        };
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   324
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   325
        final String jaasConfigName = "oracle.test.kerberos.login";
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   326
        final String krb5LoginModule = "com.sun.security.auth.module.Krb5LoginModule";
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   327
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   328
        Configuration loginConfig = new Configuration() {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   329
            @Override
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   330
            public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   331
                if (! jaasConfigName.equals(name)) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   332
                    return new AppConfigurationEntry[0];
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   333
                }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   334
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   335
                Map<String, String> options = new HashMap<String, String>();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   336
                options.put("useTicketCache", Boolean.FALSE.toString());
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   337
                options.put("useKeyTab", Boolean.FALSE.toString());
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   338
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   339
                return new AppConfigurationEntry[] {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   340
                        new AppConfigurationEntry(krb5LoginModule,
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   341
                                LoginModuleControlFlag.REQUIRED,
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   342
                                options)
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   343
                        };
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   344
            }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   345
        };
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   346
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   347
        // oracle context/subject/login
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   348
        LoginContext context = null;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   349
        try {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   350
            context = new LoginContext("oracle.test.kerberos.login", null, callback, loginConfig);
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   351
            context.login();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   352
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   353
        } catch (LoginException ex) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   354
            ex.printStackTrace();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   355
            throw new RuntimeException(ex);
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   356
        }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   357
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   358
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   359
        Subject subject = context.getSubject();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   360
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   361
        final PrivilegedExceptionAction<Object> test_action = new PrivilegedExceptionAction<Object>() {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   362
            public Object run() throws Exception {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   363
                testConnect();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   364
                return null;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   365
            }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   366
        };
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   367
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   368
        System.err.println("\n\nExpecting to succeed when executing with the the logged in subject.");
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   369
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   370
        try {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   371
            Subject.doAs(subject, test_action);
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   372
            System.err.println("\n\nConnection succeed when executing with the the logged in subject.");
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   373
        } catch (PrivilegedActionException e) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   374
            System.err.println("\n\nFailure unexpected when executing with the the logged in subject.");
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   375
            e.printStackTrace();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   376
            throw new RuntimeException("Failed to login as subject");
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   377
        }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   378
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   379
        try {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   380
            System.err.println("\n\nExpecting to fail when running with the current user's login.");
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   381
            testConnect();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   382
        } catch (Exception ex) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   383
            System.err.println("\nConnect failed when running with the current user's login:\n" + ex.getMessage());
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   384
        }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   385
    }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   386
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   387
    /**
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   388
     * Creates and starts an HTTP or proxy server that requires
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   389
     * Negotiate authentication.
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   390
     * @param scheme "Negotiate" or "Kerberos"
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   391
     * @param principal the krb5 service principal the server runs with
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   392
     * @return the server
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   393
     */
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   394
    public static HttpServer httpd(String scheme, boolean proxy,
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   395
            String principal, String ktab) throws Exception {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   396
        MyHttpHandler h = new MyHttpHandler();
9008
1c23e333dd76 7031536: test/sun/security/krb5/auto/HttpNegotiateServer.java should not use static ports
weijun
parents: 8396
diff changeset
   397
        HttpServer server = HttpServer.create(new InetSocketAddress(0), 0);
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   398
        HttpContext hc = server.createContext("/", h);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   399
        hc.setAuthenticator(new MyServerAuthenticator(
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   400
                proxy, scheme, principal, ktab));
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   401
        server.start();
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   402
        return server;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   403
    }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   404
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   405
    static class MyHttpHandler implements HttpHandler {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   406
        public void handle(HttpExchange t) throws IOException {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   407
            t.sendResponseHeaders(200, 0);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   408
            t.getResponseBody().write(CONTENT.getBytes());
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   409
            t.close();
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   410
        }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   411
    }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   412
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   413
    static class MyServerAuthenticator
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   414
            extends com.sun.net.httpserver.Authenticator {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   415
        Subject s = new Subject();
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   416
        GSSManager m = null;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   417
        GSSCredential cred = null;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   418
        String scheme = null;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   419
        String reqHdr = "WWW-Authenticate";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   420
        String respHdr = "Authorization";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   421
        int err = HttpURLConnection.HTTP_UNAUTHORIZED;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   422
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   423
        public MyServerAuthenticator(boolean proxy, String scheme,
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   424
                String principal, String ktab) throws Exception {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   425
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   426
            this.scheme = scheme;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   427
            if (proxy) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   428
                reqHdr = "Proxy-Authenticate";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   429
                respHdr = "Proxy-Authorization";
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   430
                err = HttpURLConnection.HTTP_PROXY_AUTH;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   431
            }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   432
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   433
            Krb5LoginModule krb5 = new Krb5LoginModule();
7977
f47f211cd627 7008713: diamond conversion of kerberos5 and security tools
smarks
parents: 5506
diff changeset
   434
            Map<String, String> map = new HashMap<>();
f47f211cd627 7008713: diamond conversion of kerberos5 and security tools
smarks
parents: 5506
diff changeset
   435
            Map<String, Object> shared = new HashMap<>();
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   436
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   437
            map.put("storeKey", "true");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   438
            map.put("isInitiator", "false");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   439
            map.put("useKeyTab", "true");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   440
            map.put("keyTab", ktab);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   441
            map.put("principal", principal);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   442
            krb5.initialize(s, null, shared, map);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   443
            krb5.login();
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   444
            krb5.commit();
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   445
            m = GSSManager.getInstance();
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   446
            cred = Subject.doAs(s, new PrivilegedExceptionAction<GSSCredential>() {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   447
                @Override
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   448
                public GSSCredential run() throws Exception {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   449
                    System.err.println("Creating GSSCredential");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   450
                    return m.createCredential(
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   451
                            null,
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   452
                            GSSCredential.INDEFINITE_LIFETIME,
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   453
                            MyServerAuthenticator.this.scheme.equalsIgnoreCase("Negotiate")?
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   454
                                    GSSUtil.GSS_SPNEGO_MECH_OID:
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   455
                                    GSSUtil.GSS_KRB5_MECH_OID,
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   456
                            GSSCredential.ACCEPT_ONLY);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   457
                }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   458
            });
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   459
        }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   460
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   461
        @Override
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   462
        public Result authenticate(HttpExchange exch) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   463
            // The GSContext is stored in an HttpContext attribute named
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   464
            // "GSSContext" and is created at the first request.
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   465
            GSSContext c = null;
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   466
            String auth = exch.getRequestHeaders().getFirst(respHdr);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   467
            try {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   468
                c = (GSSContext)exch.getHttpContext().getAttributes().get("GSSContext");
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   469
                if (auth == null) {                 // First request
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   470
                    Headers map = exch.getResponseHeaders();
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   471
                    map.set (reqHdr, scheme);        // Challenge!
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   472
                    c = Subject.doAs(s, new PrivilegedExceptionAction<GSSContext>() {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   473
                        @Override
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   474
                        public GSSContext run() throws Exception {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   475
                            return m.createContext(cred);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   476
                        }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   477
                    });
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   478
                    exch.getHttpContext().getAttributes().put("GSSContext", c);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   479
                    return new com.sun.net.httpserver.Authenticator.Retry(err);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   480
                } else {                            // Later requests
16020
b57c48f16179 8006182: cleanup to use java.util.Base64 in java security component, providers, and regression tests
msheppar
parents: 11107
diff changeset
   481
                    byte[] token = Base64.getMimeDecoder().decode(auth.split(" ")[1]);
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   482
                    token = c.acceptSecContext(token, 0, token.length);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   483
                    Headers map = exch.getResponseHeaders();
16020
b57c48f16179 8006182: cleanup to use java.util.Base64 in java security component, providers, and regression tests
msheppar
parents: 11107
diff changeset
   484
                    map.set (reqHdr, scheme + " " + Base64.getMimeEncoder()
b57c48f16179 8006182: cleanup to use java.util.Base64 in java security component, providers, and regression tests
msheppar
parents: 11107
diff changeset
   485
                            .encodeToString(token).replaceAll("\\s", ""));
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   486
                    if (c.isEstablished()) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   487
                        return new com.sun.net.httpserver.Authenticator.Success(
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   488
                                new HttpPrincipal(c.getSrcName().toString(), ""));
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   489
                    } else {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   490
                        return new com.sun.net.httpserver.Authenticator.Retry(err);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   491
                    }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   492
                }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   493
            } catch (Exception e) {
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   494
                throw new RuntimeException(e);
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   495
            }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   496
        }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   497
    }
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents:
diff changeset
   498
}
30685
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   499
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   500
class SecurityPolicy extends Policy {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   501
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   502
    private static Permissions perms;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   503
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   504
    public SecurityPolicy() {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   505
        super();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   506
        if (perms == null) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   507
            perms = new Permissions();
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   508
            perms.add(new AllPermission());
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   509
        }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   510
    }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   511
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   512
    @Override
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   513
    public PermissionCollection getPermissions(CodeSource codesource) {
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   514
        return perms;
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   515
    }
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   516
5806d3adbd6b 8077155: LoginContext Subject ignored by jdk8 sun.net.www.protocol.http.HttpURLConnection
robm
parents: 25151
diff changeset
   517
}