cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1543182 - in /cxf/branches/2.7.x-fixes: ./ rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java
Date Mon, 18 Nov 2013 21:53:14 GMT
Author: sergeyb
Date: Mon Nov 18 21:53:13 2013
New Revision: 1543182

URL: http://svn.apache.org/r1543182
Log:
Merged revisions 1543181 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1543181 | sergeyb | 2013-11-18 21:51:38 +0000 (Mon, 18 Nov 2013) | 1 line
  
  [CXF-5394] Reordering a bit the implicit scope response parameters to make it closer to
the spec example
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1543181

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java?rev=1543182&r1=1543181&r2=1543182&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java
Mon Nov 18 21:53:13 2013
@@ -78,18 +78,17 @@ public class ImplicitGrantService extend
    
        // return the code by appending it as a fragment parameter to the redirect URI
         
+        StringBuilder sb = getUriWithFragment(redirectUri);
+        
+        sb.append(OAuthConstants.ACCESS_TOKEN).append("=").append(token.getTokenKey());
         String state = params.getFirst(OAuthConstants.STATE);
-        StringBuilder sb = getUriWithFragment(state, redirectUri);
         if (state != null) {
             sb.append("&");
+            sb.append(OAuthConstants.STATE).append("=").append(state);   
         }
-        sb.append(OAuthConstants.ACCESS_TOKEN).append("=").append(token.getTokenKey());
         sb.append("&")
             .append(OAuthConstants.ACCESS_TOKEN_TYPE).append("=").append(token.getTokenType());
-        if (reportClientId) {
-            sb.append("&")
-                .append(OAuthConstants.CLIENT_ID).append("=").append(client.getClientId());
-        }
+        
         if (isWriteOptionalParameters()) {
             sb.append("&").append(OAuthConstants.ACCESS_TOKEN_EXPIRES_IN)
                 .append("=").append(token.getExpiresIn());
@@ -103,6 +102,10 @@ public class ImplicitGrantService extend
             }
             //TODO: also report other token parameters if any if needed  
         }
+        if (reportClientId) {
+            sb.append("&")
+                .append(OAuthConstants.CLIENT_ID).append("=").append(client.getClientId());
+        }
         
         return Response.seeOther(URI.create(sb.toString())).build();
     }
@@ -110,22 +113,21 @@ public class ImplicitGrantService extend
     protected Response createErrorResponse(MultivaluedMap<String, String> params,
                                            String redirectUri,
                                            String error) {
+        StringBuilder sb = getUriWithFragment(redirectUri);
+        sb.append(OAuthConstants.ERROR_KEY).append("=").append(error);
         String state = params.getFirst(OAuthConstants.STATE);
-        StringBuilder sb = getUriWithFragment(state, redirectUri);
         if (state != null) {
             sb.append("&");
+            sb.append(OAuthConstants.STATE).append("=").append(state);   
         }
-        sb.append(OAuthConstants.ERROR_KEY).append("=").append(error);
+        
         return Response.seeOther(URI.create(sb.toString())).build();
     }
     
-    private StringBuilder getUriWithFragment(String state, String redirectUri) {
+    private StringBuilder getUriWithFragment(String redirectUri) {
         StringBuilder sb = new StringBuilder();
         sb.append(redirectUri);
         sb.append("#");
-        if (state != null) {
-            sb.append(OAuthConstants.STATE).append("=").append(state);   
-        }
         return sb;
     }
 



Mime
View raw message