You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2006/10/08 06:06:38 UTC

svn commit: r454073 - in /incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata: GoogleLoginAuthCredentials.java GoogleLoginAuthScheme.java

Author: jmsnell
Date: Sat Oct  7 21:06:37 2006
New Revision: 454073

URL: http://svn.apache.org/viewvc?view=rev&rev=454073
Log:
There are some inconsistencies in the way various GData services implement the GoogleLogin scheme. Blogger,
for instance, will return the Gdata service name in the auth challenge while Calendar does not.  This means
that we need to pull the service name from the GoogleLoginAuthCreds when we're using Calendar.  It also 
means that we cannot use the UsernamePasswordCreds when using Calendar.  I'll come up with a better 
solution for this later.

Modified:
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthCredentials.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthScheme.java

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthCredentials.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthCredentials.java?view=diff&rev=454073&r1=454072&r2=454073
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthCredentials.java (original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/gdata/GoogleLoginAuthCredentials.java Sat Oct  7 21:06:37 2006
@@ -45,17 +45,23 @@
   implements Credentials {
 
   private final String auth;
+  private final String service;
   
   public GoogleLoginAuthCredentials(String auth) {
     this.auth = auth;
+    this.service = null;
   }
   
   public GoogleLoginAuthCredentials(String id, String pwd, String service) {
     this.auth = (new GoogleLoginAuthScheme()).getAuth(id, pwd, service);
+    this.service = service;
   }
   
   public String getAuth() {
     return auth;
   }
   
+  public String getService() {
+    return service;
+  }
 }

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=454073&r1=454072&r2=454073
==============================================================================
--- 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 Sat Oct  7 21:06:37 2006
@@ -66,8 +66,6 @@
     String challenge) 
       throws MalformedChallengeException {
     super.processChallenge(challenge);
-    if (getParameter("service") == null) 
-      throw new MalformedChallengeException("Missing service in challenge");
     service = getParameter("service");
   }
   
@@ -86,6 +84,7 @@
     } else if (credentials instanceof GoogleLoginAuthCredentials) {
       GoogleLoginAuthCredentials gcreds =
         (GoogleLoginAuthCredentials) credentials;
+      service = gcreds.getService();
       auth = gcreds.getAuth();
     } else {
       throw new AuthenticationException(
@@ -133,7 +132,7 @@
         "Email=%s&Passwd=%s&service=%s&source=%s",
         URLEncoder.encode(id, "utf-8"),
         URLEncoder.encode(pwd, "utf-8"),
-        URLEncoder.encode(service, "utf-8"),
+        (service != null) ? URLEncoder.encode(service, "utf-8") : "",
         URLEncoder.encode(Version.APP_NAME, "utf-8"));
       StringRequestEntity stringreq = new StringRequestEntity(f.toString());
       String uri = "https://www.google.com/accounts/ClientLogin";