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

Print this page

        

*** 268,284 **** * Returns info for the URL, for an HTTP server auth. Used when we * do know the realm (i.e. when we're responding to a challenge). * In this case we do not use the path because the protection space * is identified by the host:port:realm only */ ! static AuthenticationInfo getServerAuth(URL url, String realm, AuthScheme scheme) { int port = url.getPort(); if (port == -1) { port = url.getDefaultPort(); } String key = SERVER_AUTHENTICATION + ":" + scheme + ":" + url.getProtocol().toLowerCase() + ":" + url.getHost().toLowerCase() + ":" + port + ":" + realm; AuthenticationInfo cached = getAuth(key, null); if ((cached == null) && requestIsInProgress (key)) { /* check the cache again, it might contain an entry */ cached = getAuth(key, null); } --- 268,288 ---- * Returns info for the URL, for an HTTP server auth. Used when we * do know the realm (i.e. when we're responding to a challenge). * In this case we do not use the path because the protection space * is identified by the host:port:realm only */ ! static String getServerAuthKey(URL url, String realm, AuthScheme scheme) { int port = url.getPort(); if (port == -1) { port = url.getDefaultPort(); } String key = SERVER_AUTHENTICATION + ":" + scheme + ":" + url.getProtocol().toLowerCase() + ":" + url.getHost().toLowerCase() + ":" + port + ":" + realm; + return key; + } + + static AuthenticationInfo getServerAuth(String key) { AuthenticationInfo cached = getAuth(key, null); if ((cached == null) && requestIsInProgress (key)) { /* check the cache again, it might contain an entry */ cached = getAuth(key, null); }
*** 312,324 **** /** * Returns a firewall authentication, for the given host/port and realm. * Used in response to a challenge. Note, the protocol field is always * blank for proxies. */ ! static AuthenticationInfo getProxyAuth(String host, int port, String realm, AuthScheme scheme) { String key = PROXY_AUTHENTICATION + ":" + scheme + "::" + host.toLowerCase() + ":" + port + ":" + realm; AuthenticationInfo cached = (AuthenticationInfo) cache.get(key, null); if ((cached == null) && requestIsInProgress (key)) { /* check the cache again, it might contain an entry */ cached = (AuthenticationInfo) cache.get(key, null); } --- 316,332 ---- /** * Returns a firewall authentication, for the given host/port and realm. * Used in response to a challenge. Note, the protocol field is always * blank for proxies. */ ! static String getProxyAuthKey(String host, int port, String realm, AuthScheme scheme) { String key = PROXY_AUTHENTICATION + ":" + scheme + "::" + host.toLowerCase() + ":" + port + ":" + realm; + return key; + } + + static AuthenticationInfo getProxyAuth(String key) { AuthenticationInfo cached = (AuthenticationInfo) cache.get(key, null); if ((cached == null) && requestIsInProgress (key)) { /* check the cache again, it might contain an entry */ cached = (AuthenticationInfo) cache.get(key, null); }
*** 328,350 **** /** * Add this authentication to the cache */ void addToCache() { ! cache.put (cacheKey(true), this); if (supportsPreemptiveAuthorization()) { ! cache.put (cacheKey(false), this); } ! endAuthRequest(); } ! void endAuthRequest () { if (!serializeAuth) { return; } synchronized (requests) { ! requestCompleted (cacheKey(true)); } } /** * Remove this authentication from the cache --- 336,359 ---- /** * Add this authentication to the cache */ void addToCache() { ! String key = cacheKey(true); ! cache.put(key, this); if (supportsPreemptiveAuthorization()) { ! cache.put(cacheKey(false), this); } ! endAuthRequest(key); } ! static void endAuthRequest (String key) { if (!serializeAuth) { return; } synchronized (requests) { ! requestCompleted(key); } } /** * Remove this authentication from the cache