oltu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r1338534 - in /incubator/amber/trunk/oauth-2.0: oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/response/ oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/response/ oauth2-client-demo/src/main/java/org/apache/amber/oa...
Date Tue, 15 May 2012 04:50:14 GMT
Author: rfeng
Date: Tue May 15 04:50:13 2012
New Revision: 1338534

URL: http://svn.apache.org/viewvc?rev=1338534&view=rev
Log:
FIX for AMBER-53: Make sure the expires_in is a number

Modified:
    incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/response/OAuthASResponse.java
    incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/response/OAuthASResponseTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-client-demo/src/main/java/org/apache/amber/oauth2/client/demo/controller/TokenController.java
    incubator/amber/trunk/oauth-2.0/oauth2-client-demo/src/main/java/org/apache/amber/oauth2/client/demo/model/OAuthParams.java
    incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/request/ClientHeaderParametersApplier.java
    incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/request/OAuthClientRequest.java
    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/OAuthAuthzResponse.java
    incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthClientResponse.java
    incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponse.java
    incubator/amber/trunk/oauth-2.0/oauth2-client/src/test/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponseTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-client/src/test/java/org/apache/amber/oauth2/client/utils/TestUtils.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/OAuthResponse.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/BodyURLEncodedParametersApplier.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/JSONBodyParametersApplier.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/OAuthParametersApplier.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/WWWAuthHeaderParametersApplier.java
    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
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/utils/JSONUtils.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/utils/OAuthUtils.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/OAuthUtilsTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/BodyURLEncodedParametersApplierTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/JSONBodyParametersApplierTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplierTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/WWWAuthHeaderParametersApplierTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/utils/JSONUtilsTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/utils/OAuthUtilsTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-dynamicreg-client/src/main/java/org/apache/amber/oauth2/ext/dynamicreg/client/response/OAuthClientRegistrationResponse.java
    incubator/amber/trunk/oauth-2.0/oauth2-dynamicreg-server/src/main/java/org/apache/amber/oauth2/ext/dynamicreg/server/response/OAuthServerRegistrationResponse.java
    incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/CommonExt.java
    incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/EndUserAuthorizationTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/endpoints/AuthzEndpoint.java

Modified: incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/response/OAuthASResponse.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/response/OAuthASResponse.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/response/OAuthASResponse.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/response/OAuthASResponse.java Tue May 15 04:50:13 2012
@@ -73,9 +73,14 @@ public class OAuthASResponse extends OAu
         }
 
         public OAuthAuthorizationResponseBuilder setExpiresIn(String expiresIn) {
-            this.parameters.put(OAuth.OAUTH_EXPIRES_IN, expiresIn);
+            this.parameters.put(OAuth.OAUTH_EXPIRES_IN, expiresIn == null ? null : Long.valueOf(expiresIn));
             return this;
         }
+        
+        public OAuthAuthorizationResponseBuilder setExpiresIn(Long expiresIn) {
+            this.parameters.put(OAuth.OAUTH_EXPIRES_IN, expiresIn);
+            return this;
+        }        
 
         public OAuthAuthorizationResponseBuilder location(String location) {
             this.location = location;
@@ -101,7 +106,7 @@ public class OAuthASResponse extends OAu
         }
 
         public OAuthTokenResponseBuilder setExpiresIn(String expiresIn) {
-            this.parameters.put(OAuth.OAUTH_EXPIRES_IN, expiresIn);
+            this.parameters.put(OAuth.OAUTH_EXPIRES_IN, expiresIn == null ? null : Long.valueOf(expiresIn));
             return this;
         }
 

Modified: incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/response/OAuthASResponseTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/response/OAuthASResponseTest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/response/OAuthASResponseTest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/response/OAuthASResponseTest.java Tue May 15 04:50:13 2012
@@ -48,7 +48,7 @@ public class OAuthASResponseTest {
             .location("http://www.example.com")
             .setCode("code")
             .setAccessToken("access_111")
-            .setExpiresIn("400")
+            .setExpiresIn(400l)
             .setState("ok")
             .setParam("testValue", "value2")
             .buildQueryMessage();

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client-demo/src/main/java/org/apache/amber/oauth2/client/demo/controller/TokenController.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client-demo/src/main/java/org/apache/amber/oauth2/client/demo/controller/TokenController.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client-demo/src/main/java/org/apache/amber/oauth2/client/demo/controller/TokenController.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client-demo/src/main/java/org/apache/amber/oauth2/client/demo/controller/TokenController.java Tue May 15 04:50:13 2012
@@ -22,6 +22,7 @@
 package org.apache.amber.oauth2.client.demo.controller;
 
 import java.io.IOException;
+
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.amber.oauth2.client.OAuthClient;
@@ -30,18 +31,17 @@ import org.apache.amber.oauth2.client.de
 import org.apache.amber.oauth2.client.demo.exception.ApplicationException;
 import org.apache.amber.oauth2.client.demo.model.OAuthParams;
 import org.apache.amber.oauth2.client.request.OAuthClientRequest;
+import org.apache.amber.oauth2.client.response.GitHubTokenResponse;
 import org.apache.amber.oauth2.client.response.OAuthAccessTokenResponse;
+import org.apache.amber.oauth2.client.response.OAuthJSONAccessTokenResponse;
 import org.apache.amber.oauth2.common.exception.OAuthProblemException;
 import org.apache.amber.oauth2.common.exception.OAuthSystemException;
 import org.apache.amber.oauth2.common.message.types.GrantType;
-import org.apache.amber.oauth2.client.response.GitHubTokenResponse;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.servlet.ModelAndView;
 
-import org.apache.amber.oauth2.client.response.OAuthJSONAccessTokenResponse;
-
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -84,7 +84,7 @@ public class TokenController {
             oauthResponse = client.accessToken(request, cl);
 
             oauthParams.setAccessToken(oauthResponse.getAccessToken());
-            oauthParams.setExpiresIn(Utils.isIssued(oauthResponse.getExpiresIn()));
+            oauthParams.setExpiresIn(oauthResponse.getExpiresIn());
             oauthParams.setRefreshToken(Utils.isIssued(oauthResponse.getRefreshToken()));
 
             return new ModelAndView("get_resource");

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client-demo/src/main/java/org/apache/amber/oauth2/client/demo/model/OAuthParams.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client-demo/src/main/java/org/apache/amber/oauth2/client/demo/model/OAuthParams.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client-demo/src/main/java/org/apache/amber/oauth2/client/demo/model/OAuthParams.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client-demo/src/main/java/org/apache/amber/oauth2/client/demo/model/OAuthParams.java Tue May 15 04:50:13 2012
@@ -36,7 +36,7 @@ public class OAuthParams {
     private String tokenEndpoint;
     private String authzCode;
     private String accessToken;
-    private String expiresIn;
+    private long expiresIn;
     private String refreshToken;
     private String scope;
     private String resourceUrl;
@@ -109,11 +109,15 @@ public class OAuthParams {
         this.accessToken = accessToken;
     }
 
-    public String getExpiresIn() {
+    public long getExpiresIn() {
         return expiresIn;
     }
 
     public void setExpiresIn(String expiresIn) {
+        this.expiresIn = Long.parseLong(expiresIn);
+    }
+    
+    public void setExpiresIn(long expiresIn) {
         this.expiresIn = expiresIn;
     }
 

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/request/ClientHeaderParametersApplier.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/request/ClientHeaderParametersApplier.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/request/ClientHeaderParametersApplier.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/request/ClientHeaderParametersApplier.java Tue May 15 04:50:13 2012
@@ -36,7 +36,7 @@ import org.apache.amber.oauth2.common.ut
  */
 public class ClientHeaderParametersApplier implements OAuthParametersApplier {
 
-    public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, String> params)
+    public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params)
         throws OAuthSystemException {
 
         String header = OAuthUtils.encodeOAuthHeader(params);

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/request/OAuthClientRequest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/request/OAuthClientRequest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/request/OAuthClientRequest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/request/OAuthClientRequest.java Tue May 15 04:50:13 2012
@@ -98,7 +98,7 @@ public class OAuthClientRequest implemen
     public abstract static class OAuthRequestBuilder {
 
         protected OAuthParametersApplier applier;
-        protected Map<String, String> parameters = new HashMap<String, String>();
+        protected Map<String, Object> parameters = new HashMap<String, Object>();
 
         protected String url;
 

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=1338534&r1=1338533&r2=1338534&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 Tue May 15 04:50:13 2012
@@ -21,10 +21,10 @@
 
 package org.apache.amber.oauth2.client.response;
 
+import org.apache.amber.oauth2.common.OAuth;
 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;
 
 
 /**
@@ -36,19 +36,20 @@ public class GitHubTokenResponse extends
 
 
     public String getAccessToken() {
-        return parameters.get(OAuth.OAUTH_ACCESS_TOKEN);
+        return getParam(OAuth.OAUTH_ACCESS_TOKEN);
     }
 
-    public String getExpiresIn() {
-        return parameters.get(OAuth.OAUTH_EXPIRES_IN);
+    public Long getExpiresIn() {
+        String value = getParam(OAuth.OAUTH_EXPIRES_IN);
+        return value == null? null: Long.valueOf(value);
     }
 
     public String getRefreshToken() {
-        return parameters.get(OAuth.OAUTH_EXPIRES_IN);
+        return getParam(OAuth.OAUTH_EXPIRES_IN);
     }
 
     public String getScope() {
-        return parameters.get(OAuth.OAUTH_SCOPE);
+        return getParam(OAuth.OAUTH_SCOPE);
     }
 
     public OAuthToken getOAuthToken() {
@@ -68,10 +69,5 @@ public class GitHubTokenResponse extends
         this.responseCode = code;
     }
 
-    public String getParam(String name) {
-        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=1338534&r1=1338533&r2=1338534&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 Tue May 15 04:50:13 2012
@@ -34,7 +34,7 @@ public abstract class OAuthAccessTokenRe
 
     public abstract String getAccessToken();
 
-    public abstract String getExpiresIn();
+    public abstract Long getExpiresIn();
 
     public abstract String getRefreshToken();
 

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthAuthzResponse.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthAuthzResponse.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthAuthzResponse.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthAuthzResponse.java Tue May 15 04:50:13 2012
@@ -22,6 +22,7 @@
 package org.apache.amber.oauth2.client.response;
 
 import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.amber.oauth2.client.validator.CodeTokenValidator;
@@ -80,8 +81,9 @@ public class OAuthAuthzResponse extends 
         return getParam(OAuth.OAUTH_ACCESS_TOKEN);
     }
 
-    public String getExpiresIn() {
-        return getParam(OAuth.OAUTH_EXPIRES_IN);
+    public Long getExpiresIn() {
+        String value = getParam(OAuth.OAUTH_EXPIRES_IN);
+        return value == null? null: Long.valueOf(value);
     }
 
     public String getScope() {
@@ -100,10 +102,6 @@ public class OAuthAuthzResponse extends 
         return request;
     }
 
-    public String getParam(String key) {
-        return this.parameters.get(key);
-    }
-
     protected void setBody(String body) {
         this.body = body;
     }

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthClientResponse.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthClientResponse.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthClientResponse.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client/src/main/java/org/apache/amber/oauth2/client/response/OAuthClientResponse.java Tue May 15 04:50:13 2012
@@ -39,9 +39,12 @@ public abstract class OAuthClientRespons
     protected int responseCode;
 
     protected OAuthClientValidator validator;
-    protected Map<String, String> parameters = new HashMap<String, String>();
+    protected Map<String, Object> parameters = new HashMap<String, Object>();
 
-    public abstract String getParam(String param);
+    public String getParam(String param) {
+        Object value = parameters.get(param);
+        return value == null ? null : String.valueOf(value);
+    }
 
     protected abstract void setBody(String body) throws OAuthProblemException;
 
@@ -60,4 +63,5 @@ public abstract class OAuthClientRespons
     protected void validate() throws OAuthProblemException {
         validator.validate(this);
     }
+    
 }

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=1338534&r1=1338533&r2=1338534&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 Tue May 15 04:50:13 2012
@@ -41,16 +41,17 @@ public class OAuthJSONAccessTokenRespons
 
     @Override
     public String getAccessToken() {
-        return parameters.get(OAuth.OAUTH_ACCESS_TOKEN);
+        return getParam(OAuth.OAUTH_ACCESS_TOKEN);
     }
 
     @Override
-    public String getExpiresIn() {
-        return parameters.get(OAuth.OAUTH_EXPIRES_IN);
+    public Long getExpiresIn() {
+        String value = getParam(OAuth.OAUTH_EXPIRES_IN);
+        return value == null? null: Long.valueOf(value);
     }
 
     public String getScope() {
-        return parameters.get(OAuth.OAUTH_SCOPE);
+        return getParam(OAuth.OAUTH_SCOPE);
     }
 
     public OAuthToken getOAuthToken() {
@@ -58,7 +59,7 @@ public class OAuthJSONAccessTokenRespons
     }
 
     public String getRefreshToken() {
-        return parameters.get(OAuth.OAUTH_REFRESH_TOKEN);
+        return getParam(OAuth.OAUTH_REFRESH_TOKEN);
     }
 
     protected void setBody(String body) throws OAuthProblemException {
@@ -81,8 +82,4 @@ public class OAuthJSONAccessTokenRespons
         this.responseCode = code;
     }
 
-    public String getParam(String name) {
-        return parameters.get(name);
-    }
-
 }

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client/src/test/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponseTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client/src/test/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponseTest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client/src/test/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponseTest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client/src/test/java/org/apache/amber/oauth2/client/response/OAuthJSONAccessTokenResponseTest.java Tue May 15 04:50:13 2012
@@ -23,12 +23,12 @@ package org.apache.amber.oauth2.client.r
 
 import org.apache.amber.oauth2.client.utils.TestUtils;
 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.junit.Assert;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.amber.oauth2.common.error.OAuthError;
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -147,7 +147,7 @@ public class OAuthJSONAccessTokenRespons
         }
 
         String accessToken = r.getAccessToken();
-        String expiresIn = r.getExpiresIn();
+        Long expiresIn = r.getExpiresIn();
 
         Assert.assertEquals(TestUtils.EXPIRES_IN, expiresIn);
         Assert.assertEquals(TestUtils.ACCESS_TOKEN, accessToken);

Modified: incubator/amber/trunk/oauth-2.0/oauth2-client/src/test/java/org/apache/amber/oauth2/client/utils/TestUtils.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-client/src/test/java/org/apache/amber/oauth2/client/utils/TestUtils.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-client/src/test/java/org/apache/amber/oauth2/client/utils/TestUtils.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-client/src/test/java/org/apache/amber/oauth2/client/utils/TestUtils.java Tue May 15 04:50:13 2012
@@ -21,12 +21,12 @@
 
 package org.apache.amber.oauth2.client.utils;
 
+import static org.easymock.EasyMock.expect;
+
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.amber.oauth2.common.error.OAuthError;
 
-import static org.easymock.EasyMock.expect;
-
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -41,7 +41,7 @@ public final class TestUtils {
         = "{\"expires_in\":3600,\"access_token\":\"b52d434791fd52316232b6cf2d3\",\"scope\":\"read\","
         + "\"refresh_token\":\"test_refresh_token\"}";
 
-    public static final String EXPIRES_IN = "3600";
+    public static final Long EXPIRES_IN = 3600l;
     public static final String ACCESS_TOKEN = "b52d434791fd52316232b6cf2d3";
     public static final String SCOPE = "read";
     public static final String REFRESH_TOKEN = "test_refresh_token";

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/OAuthResponse.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/OAuthResponse.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/OAuthResponse.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/OAuthResponse.java Tue May 15 04:50:13 2012
@@ -107,7 +107,7 @@ public class OAuthResponse implements OA
     public static class OAuthResponseBuilder {
 
         protected OAuthParametersApplier applier;
-        protected Map<String, String> parameters = new HashMap<String, String>();
+        protected Map<String, Object> parameters = new HashMap<String, Object>();
         protected int responseCode;
         protected String location;
 

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/BodyURLEncodedParametersApplier.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/BodyURLEncodedParametersApplier.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/BodyURLEncodedParametersApplier.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/BodyURLEncodedParametersApplier.java Tue May 15 04:50:13 2012
@@ -34,7 +34,7 @@ import org.apache.amber.oauth2.common.ut
  */
 public class BodyURLEncodedParametersApplier implements OAuthParametersApplier {
 
-    public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, String> params)
+    public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params)
         throws OAuthSystemException {
 
         String body = OAuthUtils.format(params.entrySet(), "UTF-8");

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/JSONBodyParametersApplier.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/JSONBodyParametersApplier.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/JSONBodyParametersApplier.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/JSONBodyParametersApplier.java Tue May 15 04:50:13 2012
@@ -23,19 +23,18 @@ package org.apache.amber.oauth2.common.p
 
 import java.util.Map;
 
+import org.apache.amber.oauth2.common.exception.OAuthSystemException;
 import org.apache.amber.oauth2.common.message.OAuthMessage;
 import org.apache.amber.oauth2.common.utils.JSONUtils;
 import org.codehaus.jettison.json.JSONException;
 
-import org.apache.amber.oauth2.common.exception.OAuthSystemException;
-
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
  * @author Lukasz Moren (lukasz.moren@ncl.ac.uk)
  * @author Aad van Moorsel (aad.vanmoorsel@ncl.ac.uk)
  */
 public class JSONBodyParametersApplier implements OAuthParametersApplier {
-    public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, String> params)
+    public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params)
         throws OAuthSystemException {
         String json = null;
         try {

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/OAuthParametersApplier.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/OAuthParametersApplier.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/OAuthParametersApplier.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/OAuthParametersApplier.java Tue May 15 04:50:13 2012
@@ -44,6 +44,6 @@ import org.apache.amber.oauth2.common.me
  */
 public interface OAuthParametersApplier {
 
-    OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, String> params) throws
+    OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) throws
         OAuthSystemException;
 }

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java Tue May 15 04:50:13 2012
@@ -35,7 +35,7 @@ import org.apache.amber.oauth2.common.ut
  */
 public class QueryParameterApplier implements OAuthParametersApplier {
 
-    public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, String> params) {
+    public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) {
 
         String messageUrl = message.getLocationUri();
         if (messageUrl != null) {
@@ -43,7 +43,7 @@ public class QueryParameterApplier imple
             StringBuffer url = new StringBuffer(messageUrl);
 
             //apply uri fragment component if exist access_toke param
-            Map<String, String> fragmentParams = new LinkedHashMap<String, String>();
+            Map<String, Object> fragmentParams = new LinkedHashMap<String, Object>();
             if (params.containsKey(OAuth.OAUTH_ACCESS_TOKEN)) {
                 fragmentParams.put(OAuth.OAUTH_ACCESS_TOKEN, params.remove(OAuth.OAUTH_ACCESS_TOKEN));
 

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/WWWAuthHeaderParametersApplier.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/WWWAuthHeaderParametersApplier.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/WWWAuthHeaderParametersApplier.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/WWWAuthHeaderParametersApplier.java Tue May 15 04:50:13 2012
@@ -23,10 +23,10 @@ package org.apache.amber.oauth2.common.p
 
 import java.util.Map;
 
+import org.apache.amber.oauth2.common.OAuth;
 import org.apache.amber.oauth2.common.exception.OAuthSystemException;
 import org.apache.amber.oauth2.common.message.OAuthMessage;
 import org.apache.amber.oauth2.common.utils.OAuthUtils;
-import org.apache.amber.oauth2.common.OAuth;
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -35,7 +35,7 @@ import org.apache.amber.oauth2.common.OA
  */
 public class WWWAuthHeaderParametersApplier implements OAuthParametersApplier {
 
-    public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, String> params)
+    public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params)
         throws OAuthSystemException {
         String header = OAuthUtils.encodeOAuthHeader(params);
         message.addHeader(OAuth.HeaderType.WWW_AUTHENTICATE, header);

Modified: 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=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/BasicOAuthToken.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/BasicOAuthToken.java Tue May 15 04:50:13 2012
@@ -5,14 +5,14 @@ package org.apache.amber.oauth2.common.t
  */
 public class BasicOAuthToken implements OAuthToken {
     protected String accessToken;
-    protected String expiresIn;
+    protected Long expiresIn;
     protected String refreshToken;
     protected String scope;
 
     public BasicOAuthToken() {
     }
 
-    public BasicOAuthToken(String accessToken, String expiresIn, String refreshToken, String scope) {
+    public BasicOAuthToken(String accessToken, Long expiresIn, String refreshToken, String scope) {
         this.accessToken = accessToken;
         this.expiresIn = expiresIn;
         this.refreshToken = refreshToken;
@@ -23,11 +23,11 @@ public class BasicOAuthToken implements 
         this(accessToken, null, null, null);
     }
 
-    public BasicOAuthToken(String accessToken, String expiresIn) {
+    public BasicOAuthToken(String accessToken, Long expiresIn) {
         this(accessToken, expiresIn, null, null);
     }
 
-    public BasicOAuthToken(String accessToken, String expiresIn, String scope) {
+    public BasicOAuthToken(String accessToken, Long expiresIn, String scope) {
         this(accessToken, expiresIn, null, scope);
     }
 
@@ -35,7 +35,7 @@ public class BasicOAuthToken implements 
         return accessToken;
     }
 
-    public String getExpiresIn() {
+    public Long getExpiresIn() {
         return expiresIn;
     }
 

Modified: 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=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/OAuthToken.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/token/OAuthToken.java Tue May 15 04:50:13 2012
@@ -7,7 +7,7 @@ public interface OAuthToken {
 
     public String getAccessToken();
 
-    public String getExpiresIn();
+    public Long getExpiresIn();
 
     public String getRefreshToken();
 

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/utils/JSONUtils.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/utils/JSONUtils.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/utils/JSONUtils.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/utils/JSONUtils.java Tue May 15 04:50:13 2012
@@ -35,9 +35,9 @@ import org.codehaus.jettison.json.JSONOb
  */
 public final class JSONUtils {
 
-    public static String buildJSON(Map<String, String> params) throws JSONException {
+    public static String buildJSON(Map<String, Object> params) throws JSONException {
         JSONObject jsonObject = new JSONObject();
-        for (Map.Entry<String, String> param : params.entrySet()) {
+        for (Map.Entry<String, Object> param : params.entrySet()) {
             if (param.getKey() != null && !"".equals(param.getKey()) && param.getValue() != null && !""
                 .equals(param.getValue())) {
                 jsonObject.put(param.getKey(), param.getValue());
@@ -47,16 +47,16 @@ public final class JSONUtils {
         return jsonObject.toString();
     }
 
-    public static Map<String, String> parseJSON(String jsonBody) throws JSONException {
+    public static Map<String, Object> parseJSON(String jsonBody) throws JSONException {
 
-        Map<String, String> params = new HashMap<String, String>();
+        Map<String, Object> params = new HashMap<String, Object>();
         JSONObject obj = new JSONObject(jsonBody);
         Iterator it = obj.keys();
         while (it.hasNext()) {
             Object o = it.next();
             if (o instanceof String) {
                 String key = (String)o;
-                params.put(key, obj.getString(key));
+                params.put(key, obj.get(key));
             }
         }
         return params;

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/utils/OAuthUtils.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/utils/OAuthUtils.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/utils/OAuthUtils.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/utils/OAuthUtils.java Tue May 15 04:50:13 2012
@@ -82,14 +82,14 @@ public final class OAuthUtils {
      * @return Translated string
      */
     public static String format(
-        final Collection<? extends Map.Entry<String, String>> parameters,
+        final Collection<? extends Map.Entry<String, Object>> parameters,
         final String encoding) {
         final StringBuilder result = new StringBuilder();
-        for (final Map.Entry<String, String> parameter : parameters) {
+        for (final Map.Entry<String, Object> parameter : parameters) {
+            String value = parameter.getValue() == null? null : String.valueOf(parameter.getValue());
             if (!OAuthUtils.isEmpty(parameter.getKey())
-                && !OAuthUtils.isEmpty(parameter.getValue())) {
+                && !OAuthUtils.isEmpty(value)) {
                 final String encodedName = encode(parameter.getKey(), encoding);
-                final String value = parameter.getValue();
                 final String encodedValue = value != null ? encode(value, encoding) : "";
                 if (result.length() > 0) {
                     result.append(PARAMETER_SEPARATOR);
@@ -204,8 +204,8 @@ public final class OAuthUtils {
     /**
      * Parse a form-urlencoded document.
      */
-    public static Map<String, String> decodeForm(String form) {
-        Map<String, String> params = new HashMap<String, String>();
+    public static Map<String, Object> decodeForm(String form) {
+        Map<String, Object> params = new HashMap<String, Object>();
         if (!OAuthUtils.isEmpty(form)) {
             for (String nvp : form.split("\\&")) {
                 int equals = nvp.indexOf('=');
@@ -366,14 +366,15 @@ public final class OAuthUtils {
     /**
      * Construct a WWW-Authenticate or Authorization header with the OAuth challenge/credentials
      */
-    public static String encodeOAuthHeader(Map<String, String> entries) {
+    public static String encodeOAuthHeader(Map<String, Object> entries) {
         StringBuffer sb = new StringBuffer();
         sb.append(OAuth.OAUTH_HEADER_NAME).append(" ");
-        for (Map.Entry<String, String> entry : entries.entrySet()) {
-            if (!OAuthUtils.isEmpty(entry.getKey()) && !OAuthUtils.isEmpty(entry.getValue())) {
+        for (Map.Entry<String, Object> entry : entries.entrySet()) {
+            String value = entry.getValue() == null? null: String.valueOf(entry.getValue());
+            if (!OAuthUtils.isEmpty(entry.getKey()) && !OAuthUtils.isEmpty(value)) {
                 sb.append(entry.getKey());
                 sb.append("=\"");
-                sb.append(entry.getValue());
+                sb.append(value);
                 sb.append("\",");
             }
         }

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/OAuthUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/OAuthUtilsTest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/OAuthUtilsTest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/OAuthUtilsTest.java Tue May 15 04:50:13 2012
@@ -23,17 +23,17 @@ package org.apache.amber.oauth2.common;
 
 import java.util.HashMap;
 import java.util.Map;
+
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.amber.oauth2.common.error.OAuthError;
+import org.apache.amber.oauth2.common.utils.JSONUtils;
+import org.apache.amber.oauth2.common.utils.OAuthUtils;
 import org.codehaus.jettison.AbstractXMLStreamReader;
 import org.codehaus.jettison.json.JSONObject;
 import org.codehaus.jettison.mapped.MappedXMLStreamReader;
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.amber.oauth2.common.utils.OAuthUtils;
-
-import org.apache.amber.oauth2.common.utils.JSONUtils;
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -44,7 +44,7 @@ public class OAuthUtilsTest extends Asse
 
     @Test
     public void testBuildJSON() throws Exception {
-        Map<String, String> params = new HashMap<String, String>();
+        Map<String, Object> params = new HashMap<String, Object>();
         params.put(OAuthError.OAUTH_ERROR, OAuthError.TokenResponse.INVALID_REQUEST);
 
         String json = JSONUtils.buildJSON(params);
@@ -66,7 +66,7 @@ public class OAuthUtilsTest extends Asse
     @Test
     public void testEncodeOAuthHeader() throws Exception {
 
-        Map<String, String> entries = new HashMap<String, String>();
+        Map<String, Object> entries = new HashMap<String, Object>();
         entries.put("realm", "Some Example Realm");
         entries.put("error", "invalid_token");
 

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/BodyURLEncodedParametersApplierTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/BodyURLEncodedParametersApplierTest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/BodyURLEncodedParametersApplierTest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/BodyURLEncodedParametersApplierTest.java Tue May 15 04:50:13 2012
@@ -24,11 +24,11 @@ package org.apache.amber.oauth2.common.p
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.amber.oauth2.common.OAuth;
+import org.apache.amber.oauth2.common.message.OAuthMessage;
 import org.apache.amber.oauth2.common.utils.DummyOAuthMessage;
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.amber.oauth2.common.OAuth;
-import org.apache.amber.oauth2.common.message.OAuthMessage;
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -42,8 +42,8 @@ public class BodyURLEncodedParametersApp
 
         OAuthParametersApplier app = new BodyURLEncodedParametersApplier();
 
-        Map<String, String> params = new HashMap<String, String>();
-        params.put(OAuth.OAUTH_EXPIRES_IN, "3600");
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put(OAuth.OAUTH_EXPIRES_IN, 3600l);
         params.put(OAuth.OAUTH_ACCESS_TOKEN, "token_authz");
         params.put(OAuth.OAUTH_CODE, "code_");
         params.put(OAuth.OAUTH_SCOPE, "read");

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/JSONBodyParametersApplierTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/JSONBodyParametersApplierTest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/JSONBodyParametersApplierTest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/JSONBodyParametersApplierTest.java Tue May 15 04:50:13 2012
@@ -43,8 +43,8 @@ public class JSONBodyParametersApplierTe
 
         OAuthParametersApplier app = new JSONBodyParametersApplier();
 
-        Map<String, String> params = new HashMap<String, String>();
-        params.put(OAuth.OAUTH_EXPIRES_IN, "3600");
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put(OAuth.OAUTH_EXPIRES_IN, 3600l);
         params.put(OAuth.OAUTH_ACCESS_TOKEN, "token_authz");
         params.put(OAuth.OAUTH_CODE, "code_");
         params.put(OAuth.OAUTH_SCOPE, "read");
@@ -58,8 +58,8 @@ public class JSONBodyParametersApplierTe
         app.applyOAuthParameters(message, params);
 
         String msgBody = message.getBody();
-        Map<String, String> map = JSONUtils.parseJSON(msgBody);
-        Assert.assertEquals("3600", map.get(OAuth.OAUTH_EXPIRES_IN));
+        Map<String, Object> map = JSONUtils.parseJSON(msgBody);
+        Assert.assertEquals(3600, map.get(OAuth.OAUTH_EXPIRES_IN));
         Assert.assertEquals("token_authz", map.get(OAuth.OAUTH_ACCESS_TOKEN));
         Assert.assertEquals("code_", map.get(OAuth.OAUTH_CODE));
         Assert.assertEquals("read", map.get(OAuth.OAUTH_SCOPE));

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplierTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplierTest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplierTest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplierTest.java Tue May 15 04:50:13 2012
@@ -25,10 +25,10 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.amber.oauth2.common.OAuth;
+import org.apache.amber.oauth2.common.message.OAuthMessage;
 import org.apache.amber.oauth2.common.utils.DummyOAuthMessage;
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.amber.oauth2.common.message.OAuthMessage;
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -42,8 +42,8 @@ public class QueryParameterApplierTest {
 
         OAuthParametersApplier app = new QueryParameterApplier();
 
-        Map<String, String> params = new HashMap<String, String>();
-        params.put(OAuth.OAUTH_EXPIRES_IN, "3600");
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put(OAuth.OAUTH_EXPIRES_IN, 3600l);
         params.put(OAuth.OAUTH_ACCESS_TOKEN, "token_authz");
         params.put(OAuth.OAUTH_CODE, "code_");
         params.put(OAuth.OAUTH_SCOPE, "read");

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/WWWAuthHeaderParametersApplierTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/WWWAuthHeaderParametersApplierTest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/WWWAuthHeaderParametersApplierTest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/parameters/WWWAuthHeaderParametersApplierTest.java Tue May 15 04:50:13 2012
@@ -24,12 +24,10 @@ package org.apache.amber.oauth2.common.p
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.amber.oauth2.common.OAuth;
 import org.apache.amber.oauth2.common.message.OAuthResponse;
-import org.apache.amber.oauth2.common.parameters.OAuthParametersApplier;
-import org.apache.amber.oauth2.common.parameters.WWWAuthHeaderParametersApplier;
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.amber.oauth2.common.OAuth;
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -41,7 +39,7 @@ public class WWWAuthHeaderParametersAppl
     @Test
     public void testApplyOAuthParameters() throws Exception {
 
-        Map<String, String> params = new HashMap<String, String>();
+        Map<String, Object> params = new HashMap<String, Object>();
         params.put("error", "invalid_token");
         params.put("error_uri", "http://www.example.com/error");
         params.put("scope", "s1 s2 s3");

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/utils/JSONUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/utils/JSONUtilsTest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/utils/JSONUtilsTest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/utils/JSONUtilsTest.java Tue May 15 04:50:13 2012
@@ -23,10 +23,10 @@ package org.apache.amber.oauth2.common.u
 
 import java.util.HashMap;
 import java.util.Map;
+
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.amber.oauth2.common.error.OAuthError;
-import org.apache.amber.oauth2.common.utils.JSONUtils;
 import org.codehaus.jettison.AbstractXMLStreamReader;
 import org.codehaus.jettison.json.JSONObject;
 import org.codehaus.jettison.mapped.MappedXMLStreamReader;
@@ -43,7 +43,7 @@ public class JSONUtilsTest {
     @Test
     public void testBuildJSON() throws Exception {
 
-        Map<String, String> params = new HashMap<String, String>();
+        Map<String, Object> params = new HashMap<String, Object>();
         params.put(OAuthError.OAUTH_ERROR, OAuthError.TokenResponse.INVALID_REQUEST);
 
         String json = JSONUtils.buildJSON(params);
@@ -64,12 +64,12 @@ public class JSONUtilsTest {
 
     @Test
     public void testParseJson() throws Exception {
-        Map<String, String> jsonParams = new HashMap<String, String>();
+        Map<String, Object> jsonParams = new HashMap<String, Object>();
         jsonParams.put("author", "John B. Smith");
         jsonParams.put("year", "2000");
 
         String s = JSONUtils.buildJSON(jsonParams);
-        Map<String, String> map = JSONUtils.parseJSON(s);
+        Map<String, Object> map = JSONUtils.parseJSON(s);
         Assert.assertEquals("John B. Smith", map.get("author"));
         Assert.assertEquals("2000", map.get("year"));
 

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/utils/OAuthUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/utils/OAuthUtilsTest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/utils/OAuthUtilsTest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/test/java/org/apache/amber/oauth2/common/utils/OAuthUtilsTest.java Tue May 15 04:50:13 2012
@@ -28,13 +28,11 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+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.apache.amber.oauth2.common.utils.OAuthUtils;
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.amber.oauth2.common.OAuth;
-
-import org.apache.amber.oauth2.common.error.OAuthError;
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -44,7 +42,7 @@ import org.apache.amber.oauth2.common.er
 public class OAuthUtilsTest {
     @Test
     public void testFormat() throws Exception {
-        Map<String, String> parameters = new HashMap<String, String>();
+        Map<String, Object> parameters = new HashMap<String, Object>();
         parameters.put("movie", "Kiler");
         parameters.put("director", "Machulski");
 

Modified: incubator/amber/trunk/oauth-2.0/oauth2-dynamicreg-client/src/main/java/org/apache/amber/oauth2/ext/dynamicreg/client/response/OAuthClientRegistrationResponse.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-dynamicreg-client/src/main/java/org/apache/amber/oauth2/ext/dynamicreg/client/response/OAuthClientRegistrationResponse.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-dynamicreg-client/src/main/java/org/apache/amber/oauth2/ext/dynamicreg/client/response/OAuthClientRegistrationResponse.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-dynamicreg-client/src/main/java/org/apache/amber/oauth2/ext/dynamicreg/client/response/OAuthClientRegistrationResponse.java Tue May 15 04:50:13 2012
@@ -21,13 +21,13 @@
 
 package org.apache.amber.oauth2.ext.dynamicreg.client.response;
 
+import org.apache.amber.oauth2.client.response.OAuthClientResponse;
 import org.apache.amber.oauth2.common.error.OAuthError;
 import org.apache.amber.oauth2.common.exception.OAuthProblemException;
 import org.apache.amber.oauth2.common.utils.JSONUtils;
 import org.apache.amber.oauth2.ext.dynamicreg.client.validators.RegistrationValidator;
 import org.apache.amber.oauth2.ext.dynamicreg.common.OAuthRegistration;
 import org.codehaus.jettison.json.JSONException;
-import org.apache.amber.oauth2.client.response.OAuthClientResponse;
 
 
 /**
@@ -46,10 +46,6 @@ public class OAuthClientRegistrationResp
         super.init(body, contentType, responseCode);
     }
 
-    @Override
-    public String getParam(String param) {
-        return parameters.get(param);
-    }
 
     protected void setBody(String body) throws OAuthProblemException {
         try {
@@ -70,19 +66,20 @@ public class OAuthClientRegistrationResp
     }
 
     public String getClientId() {
-        return parameters.get(OAuthRegistration.Response.CLIENT_ID);
+        return getParam(OAuthRegistration.Response.CLIENT_ID);
     }
 
     public String getClientSecret() {
-        return parameters.get(OAuthRegistration.Response.CLIENT_SECRET);
+        return getParam(OAuthRegistration.Response.CLIENT_SECRET);
     }
 
     public String getIssuedAt() {
-        return parameters.get(OAuthRegistration.Response.ISSUED_AT);
+        return getParam(OAuthRegistration.Response.ISSUED_AT);
     }
 
-    public String getExpiresIn() {
-        return parameters.get(OAuthRegistration.Response.EXPIRES_IN);
+    public Long getExpiresIn() {
+        String value = getParam(OAuthRegistration.Response.EXPIRES_IN);
+        return value == null? null: Long.valueOf(value);
     }
 
 }

Modified: incubator/amber/trunk/oauth-2.0/oauth2-dynamicreg-server/src/main/java/org/apache/amber/oauth2/ext/dynamicreg/server/response/OAuthServerRegistrationResponse.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-dynamicreg-server/src/main/java/org/apache/amber/oauth2/ext/dynamicreg/server/response/OAuthServerRegistrationResponse.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-dynamicreg-server/src/main/java/org/apache/amber/oauth2/ext/dynamicreg/server/response/OAuthServerRegistrationResponse.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-dynamicreg-server/src/main/java/org/apache/amber/oauth2/ext/dynamicreg/server/response/OAuthServerRegistrationResponse.java Tue May 15 04:50:13 2012
@@ -61,6 +61,11 @@ public class OAuthServerRegistrationResp
         }
 
         public OAuthRegistrationResponseBuilder setExpiresIn(String value) {
+            this.parameters.put(OAuthRegistration.Response.EXPIRES_IN, Long.parseLong(value));
+            return this;
+        }
+        
+        public OAuthRegistrationResponseBuilder setExpiresIn(Long value) {
             this.parameters.put(OAuthRegistration.Response.EXPIRES_IN, value);
             return this;
         }

Modified: incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/CommonExt.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/CommonExt.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/CommonExt.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/CommonExt.java Tue May 15 04:50:13 2012
@@ -40,6 +40,6 @@ public final class CommonExt {
     public static final String CLIENT_ID = "someclientid";
     public static final String CLIENT_SECRET = "someclientsecret";
     public static final String ISSUED_AT = "0123456789";
-    public static final String EXPIRES_IN = "987654321";
+    public static final Long EXPIRES_IN = 987654321l;
 
 }

Modified: incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/EndUserAuthorizationTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/EndUserAuthorizationTest.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/EndUserAuthorizationTest.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/EndUserAuthorizationTest.java Tue May 15 04:50:13 2012
@@ -23,6 +23,7 @@ package org.apache.amber.oauth2.integrat
 
 import java.net.HttpURLConnection;
 import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.GET;
@@ -31,14 +32,14 @@ import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 
 import org.apache.amber.oauth2.client.request.OAuthClientRequest;
-import org.apache.amber.oauth2.common.OAuth;
-import org.apache.amber.oauth2.common.message.types.ResponseType;
-import org.junit.Test;
 import org.apache.amber.oauth2.client.response.OAuthAuthzResponse;
 import org.apache.amber.oauth2.client.response.OAuthClientResponse;
+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.apache.amber.oauth2.common.message.types.ResponseType;
 import org.apache.amber.oauth2.common.utils.OAuthUtils;
+import org.junit.Test;
 
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
@@ -87,7 +88,7 @@ public class EndUserAuthorizationTest ex
 
         HttpURLConnection c = Common.doRequest(request);
         String fragment = c.getURL().toURI().getFragment();
-        Map<String, String> map = OAuthUtils.decodeForm(fragment);
+        Map<String, Object> map = OAuthUtils.decodeForm(fragment);
 
         assertNotNull(map.get(OAuth.OAUTH_EXPIRES_IN));
         assertNotNull(map.get(OAuth.OAUTH_ACCESS_TOKEN));

Modified: incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/endpoints/AuthzEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/endpoints/AuthzEndpoint.java?rev=1338534&r1=1338533&r2=1338534&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/endpoints/AuthzEndpoint.java (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/endpoints/AuthzEndpoint.java Tue May 15 04:50:13 2012
@@ -73,7 +73,7 @@ public class AuthzEndpoint {
             }
             if (responseType.equals(ResponseType.TOKEN.toString())) {
                 builder.setAccessToken(oauthIssuerImpl.accessToken());
-                builder.setExpiresIn(String.valueOf(3600));
+                builder.setExpiresIn(3600l);
             }
 
             String redirectURI = oauthRequest.getParam(OAuth.OAUTH_REDIRECT_URI);



Mime
View raw message