cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1405852 - /cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java
Date Mon, 05 Nov 2012 15:56:37 GMT
Author: sergeyb
Date: Mon Nov  5 15:56:37 2012
New Revision: 1405852

URL: http://svn.apache.org/viewvc?rev=1405852&view=rev
Log:
[CXF-4613] More updates to ImplicitGrantService with thanks to Steven Tippetts

Modified:
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java

Modified: cxf/trunk/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/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java?rev=1405852&r1=1405851&r2=1405852&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java
Mon Nov  5 15:56:37 2012
@@ -71,9 +71,14 @@ public class ImplicitGrantService extend
    
        // return the code by appending it as a fragment parameter to the redirect URI
         
-        StringBuilder sb = getUriWithFragment(params.getFirst(OAuthConstants.STATE), redirectUri);
+        String state = params.getFirst(OAuthConstants.STATE);
+        StringBuilder sb = getUriWithFragment(state, redirectUri);
+        if (state != null) {
+            sb.append("&");
+        }
         sb.append(OAuthConstants.ACCESS_TOKEN).append("=").append(token.getTokenKey());
-        sb.append(OAuthConstants.ACCESS_TOKEN_TYPE).append("=").append(token.getTokenType());
+        sb.append("&")
+            .append(OAuthConstants.ACCESS_TOKEN_TYPE).append("=").append(token.getTokenType());
         //TODO: token parameters should also be included probably
         //      though it's not obvious the embedded client can deal with
         //      MAC tokens or other sophisticated tokens 
@@ -83,7 +88,11 @@ public class ImplicitGrantService extend
     protected Response createErrorResponse(MultivaluedMap<String, String> params,
                                            String redirectUri,
                                            String error) {
-        StringBuilder sb = getUriWithFragment(params.getFirst(OAuthConstants.STATE), redirectUri);
+        String state = params.getFirst(OAuthConstants.STATE);
+        StringBuilder sb = getUriWithFragment(state, redirectUri);
+        if (state != null) {
+            sb.append("&");
+        }
         sb.append(OAuthConstants.ERROR_KEY).append("=").append(error);
         return Response.seeOther(URI.create(sb.toString())).build();
     }



Mime
View raw message