You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/03/20 09:33:21 UTC

svn commit: r1787696 - in /httpcomponents/httpclient/branches/4.5.x: httpclient-win/src/main/java/org/apache/http/impl/auth/win/ httpclient/src/main/java/org/apache/http/impl/auth/

Author: olegk
Date: Mon Mar 20 09:33:20 2017
New Revision: 1787696

URL: http://svn.apache.org/viewvc?rev=1787696&view=rev
Log:
Code formatting; removal of unused code

Modified:
    httpcomponents/httpclient/branches/4.5.x/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateScheme.java
    httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java
    httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java

Modified: httpcomponents/httpclient/branches/4.5.x/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateScheme.java?rev=1787696&r1=1787695&r2=1787696&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateScheme.java (original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateScheme.java Mon Mar 20 09:33:20 2017
@@ -252,7 +252,8 @@ public class WindowsNegotiateScheme exte
             }
         } else {
             final HttpClientContext clientContext = HttpClientContext.adapt(context);
-            final HttpHost target = clientContext.getTargetHost();            if (target != null) {
+            final HttpHost target = clientContext.getTargetHost();
+            if (target != null) {
                 spn = "HTTP/" + target.getHostName();
             } else {
                 final RouteInfo route = clientContext.getHttpRoute();

Modified: httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java?rev=1787696&r1=1787695&r2=1787696&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java (original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java Mon Mar 20 09:33:20 2017
@@ -30,7 +30,6 @@ package org.apache.http.impl.auth;
 
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
-import org.apache.http.Consts;
 import java.security.KeyManagementException;
 import java.security.NoSuchAlgorithmException;
 import java.security.PublicKey;
@@ -42,16 +41,18 @@ import java.util.Arrays;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLEngineResult;
+import javax.net.ssl.SSLEngineResult.HandshakeStatus;
+import javax.net.ssl.SSLEngineResult.Status;
 import javax.net.ssl.SSLException;
 import javax.net.ssl.SSLPeerUnverifiedException;
 import javax.net.ssl.SSLSession;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509TrustManager;
-import javax.net.ssl.SSLEngineResult.HandshakeStatus;
-import javax.net.ssl.SSLEngineResult.Status;
 
+import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.http.Consts;
 import org.apache.http.Header;
 import org.apache.http.HttpRequest;
 import org.apache.http.auth.AUTH;
@@ -66,8 +67,6 @@ import org.apache.http.ssl.SSLContexts;
 import org.apache.http.util.CharArrayBuffer;
 import org.apache.http.util.CharsetUtils;
 
-import org.apache.commons.codec.binary.Base64;
-
 /**
  * <p>
  * Client implementation of the CredSSP protocol specified in [MS-CSSP].
@@ -118,7 +117,6 @@ public class CredSspScheme extends AuthS
 
     private State state;
     private SSLEngine sslEngine;
-    private final NTLMEngineImpl ntlmEngine;
     private NTLMEngineImpl.Type1Message type1Message;
     private NTLMEngineImpl.Type2Message type2Message;
     private NTLMEngineImpl.Type3Message type3Message;
@@ -129,11 +127,6 @@ public class CredSspScheme extends AuthS
 
 
     public CredSspScheme() {
-        this(new NTLMEngineImpl());
-    }
-
-    public CredSspScheme(final NTLMEngineImpl ntlmEngine) {
-        this.ntlmEngine = ntlmEngine;
         state = State.UNINITIATED;
     }
 

Modified: httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java?rev=1787696&r1=1787695&r2=1787696&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java (original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java Mon Mar 20 09:33:20 2017
@@ -138,70 +138,6 @@ final class NTLMEngineImpl implements NT
     }
 
     /**
-     * Returns the response for the given message.
-     *
-     * @param message
-     *            the message that was received from the server.
-     * @param username
-     *            the username to authenticate with.
-     * @param password
-     *            the password to authenticate with.
-     * @param host
-     *            The host.
-     * @param domain
-     *            the NT domain to authenticate in.
-     * @return The response.
-     * @throws org.apache.hc.core5.http.HttpException
-     *             If the messages cannot be retrieved.
-     */
-    static String getResponseFor(final String message, final String username, final String password,
-            final String host, final String domain) throws NTLMEngineException {
-
-        final String response;
-        if (message == null || message.trim().equals("")) {
-            response = getType1Message(host, domain);
-        } else {
-            final Type2Message t2m = new Type2Message(message);
-            response = getType3Message(username, password, host, domain, t2m.getChallenge(),
-                t2m.getFlags(), t2m.getTarget(), t2m.getTargetInfo());
-        }
-        return response;
-    }
-
-    /**
-     * Returns the response for the given message.
-     *
-     * @param message
-     *            the message that was received from the server.
-     * @param username
-     *            the username to authenticate with.
-     * @param password
-     *            the password to authenticate with.
-     * @param host
-     *            The host.
-     * @param domain
-     *            the NT domain to authenticate in.
-     * @return The response.
-     * @throws org.apache.http.HttpException
-     *             If the messages cannot be retrieved.
-     */
-    static String getResponseFor(final String message, final String username, final String password,
-            final String host, final String domain, final Certificate peerServerCertificate) throws NTLMEngineException {
-
-        final String response;
-        if (message == null || message.trim().equals("")) {
-            response = new Type1Message(host, domain).getResponse();
-        } else {
-            final Type1Message t1m = new Type1Message(host, domain);
-            final Type2Message t2m = new Type2Message(message);
-            response = getType3Message(username, password, host, domain, t2m.getChallenge(),
-                t2m.getFlags(), t2m.getTarget(), t2m.getTargetInfo(),
-                peerServerCertificate, t1m.getBytes(), t2m.getBytes());
-        }
-        return response;
-    }
-
-    /**
      * Creates the first message (type 1 message) in the NTLM authentication
      * sequence. This message includes the user name, domain and host for the
      * authentication session.