incubator-amber-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asa...@apache.org
Subject svn commit: r1432090 - /incubator/amber/trunk/oauth-2.0/common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java
Date Fri, 11 Jan 2013 15:27:56 GMT
Author: asanso
Date: Fri Jan 11 15:27:55 2013
New Revision: 1432090

URL: http://svn.apache.org/viewvc?rev=1432090&view=rev
Log:
AMBER-64 - QueryParameterApplier needs to include the scope parameter in the fragment 

Modified:
    incubator/amber/trunk/oauth-2.0/common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java

Modified: incubator/amber/trunk/oauth-2.0/common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java?rev=1432090&r1=1432089&r2=1432090&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java
(original)
+++ incubator/amber/trunk/oauth-2.0/common/src/main/java/org/apache/amber/oauth2/common/parameters/QueryParameterApplier.java
Fri Jan 11 15:27:55 2013
@@ -25,6 +25,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 
 import org.apache.amber.oauth2.common.OAuth;
+import org.apache.amber.oauth2.common.error.OAuthError;
 import org.apache.amber.oauth2.common.message.OAuthMessage;
 import org.apache.amber.oauth2.common.utils.OAuthUtils;
 
@@ -60,6 +61,22 @@ public class QueryParameterApplier imple
                     fragmentParams.put(OAuth.OAUTH_TOKEN_TYPE, params.remove(OAuth.OAUTH_TOKEN_TYPE));
                 }
                 
+                if (params.containsKey(OAuth.OAUTH_SCOPE)) {
+                    fragmentParams.put(OAuth.OAUTH_SCOPE, params.remove(OAuth.OAUTH_SCOPE));
+                }
+                
+                if (params.containsKey(OAuthError.OAUTH_ERROR)) {
+                    fragmentParams.put(OAuthError.OAUTH_ERROR, params.remove(OAuthError.OAUTH_ERROR));
+                }
+                
+                if (params.containsKey(OAuthError.OAUTH_ERROR_DESCRIPTION)) {
+                    fragmentParams.put(OAuthError.OAUTH_ERROR_DESCRIPTION, params.remove(OAuthError.OAUTH_ERROR_DESCRIPTION));
+                }
+                
+                if (params.containsKey(OAuthError.OAUTH_ERROR_URI)) {
+                    fragmentParams.put(OAuthError.OAUTH_ERROR_URI, params.remove(OAuthError.OAUTH_ERROR_URI));
+                }
+                
             }
 
             StringBuffer query = new StringBuffer(OAuthUtils.format(params.entrySet(), "UTF-8"));
@@ -77,7 +94,15 @@ public class QueryParameterApplier imple
             }
 
             if (!OAuthUtils.isEmpty(fragmentQuery)) {
-                url.append("#").append(fragmentQuery);
+            	if (fragmentParams.size()>1){
+            		url.append("#").append(fragmentQuery);
+            	}else{
+            		if (containsQuestionMark) {
+                        url.append("&").append(fragmentQuery);
+                    } else {
+                        url.append("?").append(fragmentQuery);
+                    }
+            	}
             }
 
             message.setLocationUri(url.toString());



Mime
View raw message