src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java

Print this page

        

*** 21,31 **** * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ ! package sun.net.www.protocol.http; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.InetAddress; import java.net.PasswordAuthentication; --- 21,31 ---- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ ! package sun.net.www.protocol.http.ntlm; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.InetAddress; import java.net.PasswordAuthentication;
*** 39,48 **** --- 39,51 ---- import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; import sun.net.www.HeaderParser; + import sun.net.www.protocol.http.AuthenticationInfo; + import sun.net.www.protocol.http.AuthScheme; + import sun.net.www.protocol.http.HttpURLConnection; /** * NTLMAuthentication: * * @author Michael McMahon
*** 66,76 **** * 2. The scope of the authentication is the TCP connection (which must be kept-alive) * after the type2 response is received. This means that NTLM does not work end-to-end * through a proxy, rather between client and proxy, or between client and server (with no proxy) */ ! class NTLMAuthentication extends AuthenticationInfo { private static final long serialVersionUID = -2403849171106437142L; private byte[] type1; private byte[] type3; --- 69,79 ---- * 2. The scope of the authentication is the TCP connection (which must be kept-alive) * after the type2 response is received. This means that NTLM does not work end-to-end * through a proxy, rather between client and proxy, or between client and server (with no proxy) */ ! public class NTLMAuthentication extends AuthenticationInfo { private static final long serialVersionUID = -2403849171106437142L; private byte[] type1; private byte[] type3;
*** 84,94 **** defaultDomain = java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction("http.auth.ntlm.domain", "domain")); }; ! static boolean supportsTransparentAuth () { return false; } private void init0() { type1 = new byte[256]; --- 87,97 ---- defaultDomain = java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction("http.auth.ntlm.domain", "domain")); }; ! public static boolean supportsTransparentAuth () { return false; } private void init0() { type1 = new byte[256];
*** 181,209 **** } /** * @return true if this authentication supports preemptive authorization */ ! boolean supportsPreemptiveAuthorization() { return false; } /** - * @return the name of the HTTP header this authentication wants set - */ - String getHeaderName() { - if (type == SERVER_AUTHENTICATION) { - return "Authorization"; - } else { - return "Proxy-authorization"; - } - } - - /** * Not supported. Must use the setHeaders() method */ ! String getHeaderValue(URL url, String method) { throw new RuntimeException ("getHeaderValue not supported"); } /** * Check if the header indicates that the current auth. parameters are stale. --- 184,203 ---- } /** * @return true if this authentication supports preemptive authorization */ ! @Override ! public boolean supportsPreemptiveAuthorization() { return false; } /** * Not supported. Must use the setHeaders() method */ ! @Override ! public String getHeaderValue(URL url, String method) { throw new RuntimeException ("getHeaderValue not supported"); } /** * Check if the header indicates that the current auth. parameters are stale.
*** 211,221 **** * and return true. Otherwise return false. * returning true means the request can be retried with the same userid/password * returning false means we have to go back to the user to ask for a new * username password. */ ! boolean isAuthorizationStale (String header) { return false; /* should not be called for ntlm */ } /** * Set header(s) on the given connection. --- 205,216 ---- * and return true. Otherwise return false. * returning true means the request can be retried with the same userid/password * returning false means we have to go back to the user to ask for a new * username password. */ ! @Override ! public boolean isAuthorizationStale (String header) { return false; /* should not be called for ntlm */ } /** * Set header(s) on the given connection.
*** 223,233 **** * @param p A source of header values for this connection, not used because * HeaderParser converts the fields to lower case, use raw instead * @param raw The raw header field. * @return true if all goes well, false if no headers were set. */ ! synchronized boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) { try { String response; if (raw.length() < 6) { /* NTLM<sp> */ response = buildType1Msg (); --- 218,229 ---- * @param p A source of header values for this connection, not used because * HeaderParser converts the fields to lower case, use raw instead * @param raw The raw header field. * @return true if all goes well, false if no headers were set. */ ! @Override ! public synchronized boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) { try { String response; if (raw.length() < 6) { /* NTLM<sp> */ response = buildType1Msg ();