You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by et...@apache.org on 2008/08/31 08:53:36 UTC

svn commit: r690646 - in /incubator/shindig/trunk/java: common/src/main/java/org/apache/shindig/common/ gadgets/src/test/java/org/apache/shindig/gadgets/http/ social-api/src/main/java/org/apache/shindig/social/core/oauth/

Author: etnu
Date: Sat Aug 30 23:53:35 2008
New Revision: 690646

URL: http://svn.apache.org/viewvc?rev=690646&view=rev
Log:
Removing duplicated AnonymousSecurityToken for SHINDIG-553.


Removed:
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousSecurityToken.java
Modified:
    incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/AnonymousSecurityToken.java
    incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/BasicSecurityTokenDecoder.java
    incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/http/HttpRequestTest.java
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousAuthenticationHandler.java

Modified: incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/AnonymousSecurityToken.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/AnonymousSecurityToken.java?rev=690646&r1=690645&r2=690646&view=diff
==============================================================================
--- incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/AnonymousSecurityToken.java (original)
+++ incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/AnonymousSecurityToken.java Sat Aug 30 23:53:35 2008
@@ -24,55 +24,46 @@
  * All methods except for isAnonymous will throw IllegalArgumentExceptions
  */
 public class AnonymousSecurityToken implements SecurityToken {
-  private static final SecurityToken instance = new AnonymousSecurityToken();
 
-  /**
-   * Private method, please use getInstance()
-   */
-  private AnonymousSecurityToken() {
-  }
+  public AnonymousSecurityToken() { }
 
-  public static SecurityToken getInstance() {
-    return instance;
+  public boolean isAnonymous() {
+    return true;
   }
 
   public String toSerialForm() {
-    throw new IllegalArgumentException();
+    throw new UnsupportedOperationException();
   }
 
   public String getOwnerId() {
-    throw new IllegalArgumentException();
+    throw new UnsupportedOperationException();
   }
 
   public String getViewerId() {
-    throw new IllegalArgumentException();
+    throw new UnsupportedOperationException();
   }
 
   public String getAppId() {
-    throw new IllegalArgumentException();
+    throw new UnsupportedOperationException();
   }
 
   public String getDomain() {
-    throw new IllegalArgumentException();
+    throw new UnsupportedOperationException();
   }
 
   public String getAppUrl() {
-    throw new IllegalArgumentException();
+    throw new UnsupportedOperationException();
   }
 
   public long getModuleId() {
-    throw new IllegalArgumentException();
+    throw new UnsupportedOperationException();
   }
 
   public String getUpdatedToken() {
-    throw new IllegalArgumentException();
+    throw new UnsupportedOperationException();
   }
 
   public String getTrustedJson() {
-    throw new IllegalArgumentException();
-  }
-
-  public boolean isAnonymous() {
-    return true;
+    throw new UnsupportedOperationException();
   }
-}
+}
\ No newline at end of file

Modified: incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/BasicSecurityTokenDecoder.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/BasicSecurityTokenDecoder.java?rev=690646&r1=690645&r2=690646&view=diff
==============================================================================
--- incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/BasicSecurityTokenDecoder.java (original)
+++ incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/BasicSecurityTokenDecoder.java Sat Aug 30 23:53:35 2008
@@ -72,7 +72,7 @@
     final String token = parameters.get(SecurityTokenDecoder.SECURITY_TOKEN_NAME);
     if (token == null || token.trim().length() == 0) {
       // No token is present, assume anonymous access
-      return AnonymousSecurityToken.getInstance();
+      return new AnonymousSecurityToken();
     }
 
     try {
@@ -80,7 +80,7 @@
       if (tokens.length != TOKEN_COUNT) {
         throw new SecurityTokenException("Malformed security token");
       }
-      
+
       return new BasicSecurityToken(
           URLDecoder.decode(tokens[OWNER_INDEX], "UTF-8"),
           URLDecoder.decode(tokens[VIEWER_INDEX], "UTF-8"),

Modified: incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/http/HttpRequestTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/http/HttpRequestTest.java?rev=690646&r1=690645&r2=690646&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/http/HttpRequestTest.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/http/HttpRequestTest.java Sat Aug 30 23:53:35 2008
@@ -18,11 +18,13 @@
  */
 package org.apache.shindig.gadgets.http;
 
-import org.apache.commons.io.IOUtils;
-import org.apache.shindig.common.AnonymousSecurityToken;
-import org.apache.shindig.common.uri.Uri;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+
+import org.apache.shindig.common.AnonymousSecurityToken;
+import org.apache.shindig.common.uri.Uri;
+
+import org.apache.commons.io.IOUtils;
 import org.junit.Test;
 
 import java.util.Arrays;
@@ -91,7 +93,7 @@
         .setMethod("POST")
         .setPostBody(POST_BODY.getBytes())
         .setRewriteMimeType("text/fake")
-        .setSecurityToken(AnonymousSecurityToken.getInstance())
+        .setSecurityToken(new AnonymousSecurityToken())
         .setSignOwner(false)
         .setSignViewer(false);
 

Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousAuthenticationHandler.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousAuthenticationHandler.java?rev=690646&r1=690645&r2=690646&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousAuthenticationHandler.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousAuthenticationHandler.java Sat Aug 30 23:53:35 2008
@@ -17,11 +17,12 @@
  */
 package org.apache.shindig.social.core.oauth;
 
+import org.apache.shindig.common.AnonymousSecurityToken;
 import org.apache.shindig.common.SecurityToken;
 import org.apache.shindig.social.opensocial.oauth.AuthenticationHandler;
 
-import com.google.inject.name.Named;
 import com.google.inject.Inject;
+import com.google.inject.name.Named;
 
 import javax.servlet.http.HttpServletRequest;