incubator-amber-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1211105 - in /incubator/amber/trunk/oauth-2.0: oauth2-authzserver/ oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/response/ oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/response/ oauth2-common/src/main/java/org/...
Date Tue, 06 Dec 2011 20:42:23 GMT
Author: tommaso
Date: Tue Dec  6 20:42:22 2011
New Revision: 1211105

URL: http://svn.apache.org/viewvc?rev=1211105&view=rev
Log:
[AMBER-36] - applied patch from Antonio Sanso plus updated oauth2-common version used in authzserver
to 0.22-incubating-SNAPSHOT

Modified:
    incubator/amber/trunk/oauth-2.0/oauth2-authzserver/pom.xml
    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-common/src/main/java/org/apache/amber/oauth2/common/OAuth.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/types/GrantType.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/types/ResponseType.java
    incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java

Modified: incubator/amber/trunk/oauth-2.0/oauth2-authzserver/pom.xml
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-authzserver/pom.xml?rev=1211105&r1=1211104&r2=1211105&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-authzserver/pom.xml (original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-authzserver/pom.xml Tue Dec  6 20:42:22 2011
@@ -42,7 +42,7 @@
         <dependency>
             <groupId>org.apache.amber</groupId>
             <artifactId>oauth2-common</artifactId>
-           <version>0.2-SNAPSHOT</version>
+           <version>0.22-incubating-SNAPSHOT</version>
         </dependency>
 
         <dependency>

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=1211105&r1=1211104&r2=1211105&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 Dec  6 20:42:22 2011
@@ -102,6 +102,11 @@ public class OAuthASResponse extends OAu
             this.parameters.put(OAuth.OAUTH_REFRESH_TOKEN, refreshToken);
             return this;
         }
+        
+        public OAuthTokenResponseBuilder setTokenType(String tokenType) {
+            this.parameters.put(OAuth.OAUTH_TOKEN_TYPE, tokenType);
+            return this;
+        }
 
         public OAuthTokenResponseBuilder setParam(String key, String value) {
             this.parameters.put(key, value);

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=1211105&r1=1211104&r2=1211105&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 Dec  6 20:42:22 2011
@@ -21,15 +21,13 @@
 
 package org.apache.amber.oauth2.as.response;
 
-import org.apache.amber.oauth2.as.response.OAuthASResponse;
+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.OAuthResponse;
 import org.junit.Assert;
 import org.junit.Test;
 
-import org.apache.amber.oauth2.common.OAuth;
-import org.apache.amber.oauth2.common.exception.OAuthProblemException;
-
 /**
  * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
  * @author Lukasz Moren (lukasz.moren@ncl.ac.uk)
@@ -50,8 +48,8 @@ public class OAuthASResponseTest {
 
         String url = oAuthResponse.getLocationUri();
 
-        Assert.assertEquals("http://www.example.com?testValue=value2&state=ok&code=code"
-            + "#expires_in=400&access_token=access_111", url);
+        Assert.assertEquals("http://www.example.com?testValue=value2&code=code"
+            + "#access_token=access_111&state=ok&expires_in=400", url);
         Assert.assertEquals(200, oAuthResponse.getResponseStatus());
 
     }

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/OAuth.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/OAuth.java?rev=1211105&r1=1211104&r2=1211105&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/OAuth.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/OAuth.java
Tue Dec  6 20:42:22 2011
@@ -71,6 +71,8 @@ public final class OAuth {
     public static final String OAUTH_ACCESS_TOKEN = "access_token";
     public static final String OAUTH_EXPIRES_IN = "expires_in";
     public static final String OAUTH_REFRESH_TOKEN = "refresh_token";
+    
+    public static final String OAUTH_TOKEN_TYPE = "token_type";
 
     public static final String OAUTH_TOKEN = "oauth_token";
 

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/types/GrantType.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/types/GrantType.java?rev=1211105&r1=1211104&r2=1211105&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/types/GrantType.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/types/GrantType.java
Tue Dec  6 20:42:22 2011
@@ -29,8 +29,10 @@ package org.apache.amber.oauth2.common.m
 public enum GrantType {
     AUTHORIZATION_CODE("authorization_code"),
     PASSWORD("password"),
+    @Deprecated
     ASSERTION("assertion"),
     REFRESH_TOKEN("refresh_token"),
+    CLIENT_CREDENTIALS("client_credentials"),
     NONE("none");
 
     private String grantType;

Modified: incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/types/ResponseType.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/types/ResponseType.java?rev=1211105&r1=1211104&r2=1211105&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/types/ResponseType.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-common/src/main/java/org/apache/amber/oauth2/common/message/types/ResponseType.java
Tue Dec  6 20:42:22 2011
@@ -30,6 +30,7 @@ public enum ResponseType {
 
     CODE("code"),
     TOKEN("token"),
+    @Deprecated
     CODE_AND_TOKEN("code_and_token");
 
     private String code;

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=1211105&r1=1211104&r2=1211105&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 Dec  6 20:42:22 2011
@@ -21,7 +21,7 @@
 
 package org.apache.amber.oauth2.common.parameters;
 
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
 import org.apache.amber.oauth2.common.OAuth;
@@ -43,13 +43,23 @@ public class QueryParameterApplier imple
             StringBuffer url = new StringBuffer(messageUrl);
 
             //apply uri fragment component if exist access_toke param
-            Map<String, String> fragmentParams = new HashMap<String, String>();
+            Map<String, String> fragmentParams = new LinkedHashMap<String, String>();
             if (params.containsKey(OAuth.OAUTH_ACCESS_TOKEN)) {
                 fragmentParams.put(OAuth.OAUTH_ACCESS_TOKEN, params.remove(OAuth.OAUTH_ACCESS_TOKEN));
 
+                // State should be in the fragment too
+                if (params.containsKey(OAuth.OAUTH_STATE)) {
+                    fragmentParams.put(OAuth.OAUTH_STATE, params.remove(OAuth.OAUTH_STATE));
+                }
+                
                 if (params.containsKey(OAuth.OAUTH_EXPIRES_IN)) {
                     fragmentParams.put(OAuth.OAUTH_EXPIRES_IN, params.remove(OAuth.OAUTH_EXPIRES_IN));
                 }
+                
+                if (params.containsKey(OAuth.OAUTH_TOKEN_TYPE)) {
+                    fragmentParams.put(OAuth.OAUTH_TOKEN_TYPE, params.remove(OAuth.OAUTH_TOKEN_TYPE));
+                }
+                
             }
 
             StringBuffer query = new StringBuffer(OAuthUtils.format(params.entrySet(), "UTF-8"));



Mime
View raw message