You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by do...@apache.org on 2008/08/07 21:54:40 UTC

svn commit: r683695 - in /incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth: AnonymousSecurityToken.java OAuthSecurityToken.java

Author: doll
Date: Thu Aug  7 12:54:39 2008
New Revision: 683695

URL: http://svn.apache.org/viewvc?rev=683695&view=rev
Log:
Added an anonymous and an oauth security token. These will be used by the AuthenticationServletFilter. 

Note: the addition of an isAnonymous flag on the security token should probably be pulled up to common.


Added:
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousSecurityToken.java
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthSecurityToken.java

Added: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousSecurityToken.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousSecurityToken.java?rev=683695&view=auto
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousSecurityToken.java (added)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/AnonymousSecurityToken.java Thu Aug  7 12:54:39 2008
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.social.core.oauth;
+
+import org.apache.shindig.common.SecurityToken;
+
+public class AnonymousSecurityToken implements SecurityToken {
+
+  public AnonymousSecurityToken() { }
+
+  // TODO: We should probably pull this method up into the base SecurityToken interface
+  public boolean isAnonymous() {
+    return true;
+  }
+
+  public String toSerialForm() {
+    throw new UnsupportedOperationException();
+  }
+
+  public String getOwnerId() {
+    throw new UnsupportedOperationException();
+  }
+
+  public String getViewerId() {
+    throw new UnsupportedOperationException();
+  }
+
+  public String getAppId() {
+    throw new UnsupportedOperationException();
+  }
+
+  public String getDomain() {
+    throw new UnsupportedOperationException();
+  }
+
+  public String getAppUrl() {
+    throw new UnsupportedOperationException();
+  }
+
+  public long getModuleId() {
+    throw new UnsupportedOperationException();
+  }
+
+  public String getUpdatedToken() {
+    throw new UnsupportedOperationException();
+  }
+
+  public String getTrustedJson() {
+    throw new UnsupportedOperationException();
+  }
+}
\ No newline at end of file

Added: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthSecurityToken.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthSecurityToken.java?rev=683695&view=auto
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthSecurityToken.java (added)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthSecurityToken.java Thu Aug  7 12:54:39 2008
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.social.core.oauth;
+
+import org.apache.shindig.common.SecurityToken;
+
+public class OAuthSecurityToken implements SecurityToken {
+  private final String userId;
+  private final String appUrl;
+  private final String appId;
+  private final String domain;
+
+  public OAuthSecurityToken(String userId, String appUrl, String appId, String domain) {
+    this.userId = userId;
+    this.appUrl = appUrl;
+    this.appId = appId;
+    this.domain = domain;
+  }
+
+  public String getOwnerId() {
+    return userId;
+  }
+
+  public String getViewerId() {
+    return userId;
+  }
+
+  public String getAppId() {
+    return appId;
+  }
+
+  public String getDomain() {
+    return domain;
+  }
+
+  public String getAppUrl() {
+    return appUrl;
+  }
+
+  // We don't support this concept yet. We probably don't need to as opensocial calls don't
+  // currently depend on the app instance id.
+  public long getModuleId() {
+    throw new UnsupportedOperationException();
+  }
+
+  // Not needed for this basic token
+  public String toSerialForm() {
+    throw new UnsupportedOperationException();
+  }
+
+  public String getUpdatedToken() {
+    throw new UnsupportedOperationException();
+  }
+
+  public String getTrustedJson() {
+    throw new UnsupportedOperationException();
+  }
+}