abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r530172 - in /incubator/abdera/java/trunk: client/src/main/java/org/apache/abdera/protocol/client/ extensions/src/main/java/org/apache/abdera/ext/gdata/ extensions/src/main/java/org/apache/abdera/ext/wsse/
Date Wed, 18 Apr 2007 21:49:49 GMT
Author: jmsnell
Date: Wed Apr 18 14:49:48 2007
New Revision: 530172

URL: http://svn.apache.org/viewvc?view=rev&rev=530172
Log:
Make it a bit easier to register alternative auth schemes

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/wsse/WSSEAuthScheme.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java?view=diff&rev=530172&r1=530171&r2=530172
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java
Wed Apr 18 14:49:48 2007
@@ -88,6 +88,7 @@
       HttpClientParams.USE_EXPECT_CONTINUE, true);  
     client.getParams().setCookiePolicy(
       CookiePolicy.BROWSER_COMPATIBILITY);
+    setAuthenticationSchemeDefaults();
   }
   
   /**
@@ -225,11 +226,20 @@
       scope, credentials);
   }
 
+  public void setAuthenticationSchemeDefaults() {
+    List authPrefs = AuthPolicy.getDefaultAuthPrefs();
+    client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
+  }
+  
   public void setAuthenticationSchemePriority(String... scheme) {
     List authPrefs = java.util.Arrays.asList(scheme);
     client.getParams().setParameter(
       AuthPolicy.AUTH_SCHEME_PRIORITY, 
       authPrefs);
+  }
+  
+  public List getAuthenticationSchemePriority() {
+    return (List)client.getParams().getParameter(AuthPolicy.AUTH_SCHEME_PRIORITY);
   }
   
   /**

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java?view=diff&rev=530172&r1=530171&r2=530172
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java
Wed Apr 18 14:49:48 2007
@@ -55,8 +55,12 @@
   extends RFC2617Scheme
   implements AuthScheme {
   
-  public static void register() {
+  public static void register(Client client, boolean exclusive) {
     Client.registerScheme("GoogleLogin", GoogleLoginAuthScheme.class);
+    if (exclusive)
+      ((CommonsClient)client).setAuthenticationSchemePriority("GoogleLogin");
+    else
+      ((CommonsClient)client).setAuthenticationSchemeDefaults();
   }
   
   private String service = null;

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/wsse/WSSEAuthScheme.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/wsse/WSSEAuthScheme.java?view=diff&rev=530172&r1=530171&r2=530172
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/wsse/WSSEAuthScheme.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/wsse/WSSEAuthScheme.java
Wed Apr 18 14:49:48 2007
@@ -22,6 +22,8 @@
 import java.util.Date;
 
 import org.apache.abdera.model.AtomDate;
+import org.apache.abdera.protocol.client.Client;
+import org.apache.abdera.protocol.client.CommonsClient;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.codec.binary.Hex;
 import org.apache.commons.httpclient.Credentials;
@@ -42,6 +44,14 @@
   implements AuthScheme {
 
   private final int NONCE_LENGTH = 16;
+  
+  public static void register(Client client, boolean exclusive) {
+    Client.registerScheme("WSSE", WSSEAuthScheme.class);
+    if (exclusive)
+      ((CommonsClient)client).setAuthenticationSchemePriority("WSSE");
+    else
+      ((CommonsClient)client).setAuthenticationSchemeDefaults();
+  }
   
   @Override
   public String authenticate(



Mime
View raw message