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

Print this page

        

@@ -21,11 +21,11 @@
  * 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;
+package sun.net.www.protocol.http.ntlm;
 
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.InetAddress;
 import java.net.PasswordAuthentication;

@@ -39,10 +39,13 @@
 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,11 +69,11 @@
  * 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 {
+public class NTLMAuthentication extends AuthenticationInfo {
     private static final long serialVersionUID = -2403849171106437142L;
 
     private byte[] type1;
     private byte[] type3;
 

@@ -84,11 +87,11 @@
         defaultDomain = java.security.AccessController.doPrivileged(
             new sun.security.action.GetPropertyAction("http.auth.ntlm.domain",
                                                       "domain"));
     };
 
-    static boolean supportsTransparentAuth () {
+    public static boolean supportsTransparentAuth () {
         return false;
     }
 
     private void init0() {
         type1 = new byte[256];

@@ -181,29 +184,20 @@
     }
 
     /**
      * @return true if this authentication supports preemptive authorization
      */
-    boolean supportsPreemptiveAuthorization() {
+    @Override
+    public 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) {
+    @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,11 +205,12 @@
      * 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) {
+    @Override
+    public boolean isAuthorizationStale (String header) {
         return false; /* should not be called for ntlm */
     }
 
     /**
      * Set header(s) on the given connection.

@@ -223,11 +218,12 @@
      * @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) {
+    @Override
+    public synchronized boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) {
 
         try {
             String response;
             if (raw.length() < 6) { /* NTLM<sp> */
                 response = buildType1Msg ();