hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1602398 - /httpcomponents/httpclient/trunk/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsCredentialsProvider.java
Date Fri, 13 Jun 2014 12:02:02 GMT
Author: olegk
Date: Fri Jun 13 12:02:02 2014
New Revision: 1602398

URL: http://svn.apache.org/r1602398
Log:
 HTTPCLIENT-1394: made WindowsCredentialsProvider a decorator for an arbitrary CredentialsProvider

Modified:
    httpcomponents/httpclient/trunk/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsCredentialsProvider.java

Modified: httpcomponents/httpclient/trunk/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsCredentialsProvider.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsCredentialsProvider.java?rev=1602398&r1=1602397&r2=1602398&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsCredentialsProvider.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsCredentialsProvider.java
Fri Jun 13 12:02:02 2014
@@ -29,8 +29,9 @@ package org.apache.http.impl.auth.win;
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.Credentials;
+import org.apache.http.client.CredentialsProvider;
 import org.apache.http.client.config.AuthSchemes;
-import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.util.Args;
 
 /**
  * {@link org.apache.http.client.CredentialsProvider} implementation that always returns
@@ -42,7 +43,13 @@ import org.apache.http.impl.client.Basic
  * @since 4.4
  */
 @ThreadSafe
-public class WindowsCredentialsProvider extends BasicCredentialsProvider {
+public class WindowsCredentialsProvider implements CredentialsProvider {
+
+    private final CredentialsProvider provider;
+
+    public WindowsCredentialsProvider(final CredentialsProvider provider) {
+        this.provider = Args.notNull(provider, "Credentials provider");
+    }
 
     @Override
     public Credentials getCredentials(final AuthScope authscope) {
@@ -50,10 +57,19 @@ public class WindowsCredentialsProvider 
         if (AuthSchemes.NTLM.equalsIgnoreCase(scheme) || AuthSchemes.SPNEGO.equalsIgnoreCase(scheme))
{
             return CurrentWindowsCredentials.INSTANCE;
         } else {
-            return super.getCredentials(authscope);
+            return provider.getCredentials(authscope);
         }
     }
 
+    @Override
+    public void setCredentials(final AuthScope authscope, final Credentials credentials)
{
+        provider.setCredentials(authscope, credentials);
+    }
+
+    @Override
+    public void clear() {
+        provider.clear();
+    }
 }
 
 



Mime
View raw message