incubator-amber-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmo...@apache.org
Subject svn commit: r1146613 - in /incubator/amber/trunk/oauth-2.0: oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/ oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/
Date Thu, 14 Jul 2011 09:40:39 GMT
Author: lmoren
Date: Thu Jul 14 09:40:39 2011
New Revision: 1146613

URL: http://svn.apache.org/viewvc?rev=1146613&view=rev
Log:
- added OAuthToken class for access token response from AS

Added:
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/BasicOAuthToken.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/OAuthToken.java
Modified:
    incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/GitHubTokenResponse.java
    incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthAccessTokenResponse.java
    incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponse.java

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/GitHubTokenResponse.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/GitHubTokenResponse.java?rev=1146613&r1=1146612&r2=1146613&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/GitHubTokenResponse.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/GitHubTokenResponse.java
Thu Jul 14 09:40:39 2011
@@ -21,6 +21,8 @@
 
 package org.apache.amber.oauth2.client.response;
 
+import org.apache.amber.oauth2.common.token.BasicOAuthToken;
+import org.apache.amber.oauth2.common.token.OAuthToken;
 import org.apache.amber.oauth2.common.utils.OAuthUtils;
 import org.apache.amber.oauth2.common.OAuth;
 
@@ -49,6 +51,10 @@ public class GitHubTokenResponse extends
         return parameters.get(OAuth.OAUTH_SCOPE);
     }
 
+    public OAuthToken getOAuthToken() {
+        return new BasicOAuthToken(getAccessToken(), getExpiresIn(), getRefreshToken(), getScope());
+    }
+
     protected void setBody(String body) {
         this.body = body;
         parameters = OAuthUtils.decodeForm(body);
@@ -66,4 +72,6 @@ public class GitHubTokenResponse extends
         return parameters.get(name);
     }
 
+
+
 }

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthAccessTokenResponse.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthAccessTokenResponse.java?rev=1146613&r1=1146612&r2=1146613&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthAccessTokenResponse.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthAccessTokenResponse.java
Thu Jul 14 09:40:39 2011
@@ -23,6 +23,7 @@ package org.apache.amber.oauth2.client.r
 
 import org.apache.amber.oauth2.client.validator.TokenValidator;
 import org.apache.amber.oauth2.common.exception.OAuthProblemException;
+import org.apache.amber.oauth2.common.token.OAuthToken;
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -39,6 +40,8 @@ public abstract class OAuthAccessTokenRe
 
     public abstract String getScope();
 
+    public abstract OAuthToken getOAuthToken();
+
     public String getBody() {
         return body;
     }

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponse.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponse.java?rev=1146613&r1=1146612&r2=1146613&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponse.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponse.java
Thu Jul 14 09:40:39 2011
@@ -24,9 +24,10 @@ package org.apache.amber.oauth2.client.r
 import org.apache.amber.oauth2.common.OAuth;
 import org.apache.amber.oauth2.common.error.OAuthError;
 import org.apache.amber.oauth2.common.exception.OAuthProblemException;
-import org.codehaus.jettison.json.JSONException;
-
+import org.apache.amber.oauth2.common.token.BasicOAuthToken;
+import org.apache.amber.oauth2.common.token.OAuthToken;
 import org.apache.amber.oauth2.common.utils.JSONUtils;
+import org.codehaus.jettison.json.JSONException;
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -52,6 +53,10 @@ public class OAuthJSONAccessTokenRespons
         return parameters.get(OAuth.OAUTH_SCOPE);
     }
 
+    public OAuthToken getOAuthToken() {
+        return new BasicOAuthToken(getAccessToken(), getExpiresIn(), getRefreshToken(), getScope());
+    }
+
     public String getRefreshToken() {
         return parameters.get(OAuth.OAUTH_REFRESH_TOKEN);
     }

Added: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/BasicOAuthToken.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/BasicOAuthToken.java?rev=1146613&view=auto
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/BasicOAuthToken.java
(added)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/BasicOAuthToken.java
Thu Jul 14 09:40:39 2011
@@ -0,0 +1,37 @@
+package org.apache.amber.oauth2.common.token;
+
+/**
+ * @author Lukasz Moren
+ */
+public class BasicOAuthToken implements OAuthToken {
+    protected String accessToken;
+    protected String expiresIn;
+    protected String refreshToken;
+    protected String scope;
+
+    public BasicOAuthToken() {
+    }
+
+    public BasicOAuthToken(String accessToken, String expiresIn, String refreshToken, String
scope) {
+        this.accessToken = accessToken;
+        this.expiresIn = expiresIn;
+        this.refreshToken = refreshToken;
+        this.scope = scope;
+    }
+
+    public String getAccessToken() {
+        return accessToken;
+    }
+
+    public String getExpiresIn() {
+        return expiresIn;
+    }
+
+    public String getRefreshToken() {
+        return refreshToken;
+    }
+
+    public String getScope() {
+        return scope;
+    }
+}

Added: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/OAuthToken.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/OAuthToken.java?rev=1146613&view=auto
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/OAuthToken.java
(added)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/OAuthToken.java
Thu Jul 14 09:40:39 2011
@@ -0,0 +1,15 @@
+package org.apache.amber.oauth2.common.token;
+
+/**
+ * @author Lukasz Moren
+ */
+public interface OAuthToken {
+
+    public String getAccessToken();
+
+    public String getExpiresIn();
+
+    public String getRefreshToken();
+
+    public String getScope();
+}



Mime
View raw message