src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java

Print this page




2048                          * transparent authentication (Windows only) the username
2049                          * and password will be picked up from the current logged
2050                          * on users credentials.
2051                         */
2052                         if (tryTransparentNTLMProxy ||
2053                               (!tryTransparentNTLMProxy && a != null)) {
2054                             ret = NTLMAuthenticationProxy.proxy.create(true, host, port, a);
2055                         }
2056 
2057                         /* set to false so that we do not try again */
2058                         tryTransparentNTLMProxy = false;
2059                     }
2060                     break;
2061                 case NEGOTIATE:
2062                     ret = new NegotiateAuthentication(new HttpCallerInfo(authhdr.getHttpCallerInfo(), "Negotiate"));
2063                     break;
2064                 case KERBEROS:
2065                     ret = new NegotiateAuthentication(new HttpCallerInfo(authhdr.getHttpCallerInfo(), "Kerberos"));
2066                     break;
2067                 case UNKNOWN:

2068                     logger.finest("Unknown/Unsupported authentication scheme: " + scheme);

2069                 /*fall through*/
2070                 default:
2071                     throw new AssertionError("should not reach here");
2072                 }
2073             }
2074             // For backwards compatibility, we also try defaultAuth
2075             // REMIND:  Get rid of this for JDK2.0.
2076 
2077             if (ret == null && defaultAuth != null
2078                 && defaultAuth.schemeSupported(scheme)) {
2079                 try {
2080                     URL u = new URL("http", host, port, "/");
2081                     String a = defaultAuth.authString(u, scheme, realm);
2082                     if (a != null) {
2083                         ret = new BasicAuthentication (true, host, port, realm, a);
2084                         // not in cache by default - cache on success
2085                     }
2086                 } catch (java.net.MalformedURLException ignored) {
2087                 }
2088             }


2205                                 url.getHost(), addr, port, url.getProtocol(),
2206                                 "", scheme, url, RequestorType.SERVER);
2207                         }
2208 
2209                         /* If we are not trying transparent authentication then
2210                          * we need to have a PasswordAuthentication instance. For
2211                          * transparent authentication (Windows only) the username
2212                          * and password will be picked up from the current logged
2213                          * on users credentials.
2214                          */
2215                         if (tryTransparentNTLMServer ||
2216                               (!tryTransparentNTLMServer && a != null)) {
2217                             ret = NTLMAuthenticationProxy.proxy.create(false, url1, a);
2218                         }
2219 
2220                         /* set to false so that we do not try again */
2221                         tryTransparentNTLMServer = false;
2222                     }
2223                     break;
2224                 case UNKNOWN:

2225                     logger.finest("Unknown/Unsupported authentication scheme: " + scheme);

2226                 /*fall through*/
2227                 default:
2228                     throw new AssertionError("should not reach here");
2229                 }
2230             }
2231 
2232             // For backwards compatibility, we also try defaultAuth
2233             // REMIND:  Get rid of this for JDK2.0.
2234 
2235             if (ret == null && defaultAuth != null
2236                 && defaultAuth.schemeSupported(scheme)) {
2237                 String a = defaultAuth.authString(url, scheme, realm);
2238                 if (a != null) {
2239                     ret = new BasicAuthentication (false, url, realm, a);
2240                     // not in cache by default - cache on success
2241                 }
2242             }
2243 
2244             if (ret != null ) {
2245                 if (!ret.setHeaders(this, p, raw)) {




2048                          * transparent authentication (Windows only) the username
2049                          * and password will be picked up from the current logged
2050                          * on users credentials.
2051                         */
2052                         if (tryTransparentNTLMProxy ||
2053                               (!tryTransparentNTLMProxy && a != null)) {
2054                             ret = NTLMAuthenticationProxy.proxy.create(true, host, port, a);
2055                         }
2056 
2057                         /* set to false so that we do not try again */
2058                         tryTransparentNTLMProxy = false;
2059                     }
2060                     break;
2061                 case NEGOTIATE:
2062                     ret = new NegotiateAuthentication(new HttpCallerInfo(authhdr.getHttpCallerInfo(), "Negotiate"));
2063                     break;
2064                 case KERBEROS:
2065                     ret = new NegotiateAuthentication(new HttpCallerInfo(authhdr.getHttpCallerInfo(), "Kerberos"));
2066                     break;
2067                 case UNKNOWN:
2068                     if (logger.isLoggable(PlatformLogger.FINEST)) {
2069                         logger.finest("Unknown/Unsupported authentication scheme: " + scheme);
2070                     }
2071                 /*fall through*/
2072                 default:
2073                     throw new AssertionError("should not reach here");
2074                 }
2075             }
2076             // For backwards compatibility, we also try defaultAuth
2077             // REMIND:  Get rid of this for JDK2.0.
2078 
2079             if (ret == null && defaultAuth != null
2080                 && defaultAuth.schemeSupported(scheme)) {
2081                 try {
2082                     URL u = new URL("http", host, port, "/");
2083                     String a = defaultAuth.authString(u, scheme, realm);
2084                     if (a != null) {
2085                         ret = new BasicAuthentication (true, host, port, realm, a);
2086                         // not in cache by default - cache on success
2087                     }
2088                 } catch (java.net.MalformedURLException ignored) {
2089                 }
2090             }


2207                                 url.getHost(), addr, port, url.getProtocol(),
2208                                 "", scheme, url, RequestorType.SERVER);
2209                         }
2210 
2211                         /* If we are not trying transparent authentication then
2212                          * we need to have a PasswordAuthentication instance. For
2213                          * transparent authentication (Windows only) the username
2214                          * and password will be picked up from the current logged
2215                          * on users credentials.
2216                          */
2217                         if (tryTransparentNTLMServer ||
2218                               (!tryTransparentNTLMServer && a != null)) {
2219                             ret = NTLMAuthenticationProxy.proxy.create(false, url1, a);
2220                         }
2221 
2222                         /* set to false so that we do not try again */
2223                         tryTransparentNTLMServer = false;
2224                     }
2225                     break;
2226                 case UNKNOWN:
2227                     if (logger.isLoggable(PlatformLogger.FINEST)) {
2228                         logger.finest("Unknown/Unsupported authentication scheme: " + scheme);
2229                     }
2230                 /*fall through*/
2231                 default:
2232                     throw new AssertionError("should not reach here");
2233                 }
2234             }
2235 
2236             // For backwards compatibility, we also try defaultAuth
2237             // REMIND:  Get rid of this for JDK2.0.
2238 
2239             if (ret == null && defaultAuth != null
2240                 && defaultAuth.schemeSupported(scheme)) {
2241                 String a = defaultAuth.authString(url, scheme, realm);
2242                 if (a != null) {
2243                     ret = new BasicAuthentication (false, url, realm, a);
2244                     // not in cache by default - cache on success
2245                 }
2246             }
2247 
2248             if (ret != null ) {
2249                 if (!ret.setHeaders(this, p, raw)) {