cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [03/20] cxf git commit: Updating ClientCodeRequestFilter to support the case where start and complete URIs are the same
Date Sat, 16 Jul 2016 15:53:27 GMT
Updating ClientCodeRequestFilter to support the case where start and complete URIs are the
same


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ef4fe2d8
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ef4fe2d8
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ef4fe2d8

Branch: refs/heads/master-jaxrs-2.1
Commit: ef4fe2d84010a48b596908581e0c98b367b0ed92
Parents: 366a556
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Jul 13 21:19:10 2016 +0300
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Jul 13 21:19:10 2016 +0300

----------------------------------------------------------------------
 .../oauth2/client/ClientCodeRequestFilter.java  | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ef4fe2d8/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/ClientCodeRequestFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/ClientCodeRequestFilter.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/ClientCodeRequestFilter.java
index c104cf1..85aa526 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/ClientCodeRequestFilter.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/ClientCodeRequestFilter.java
@@ -94,7 +94,7 @@ public class ClientCodeRequestFilter implements ContainerRequestFilter {
             } 
         }
         
-        if (!sameUriRedirect && isStartUriMatched(absoluteRequestUri)) {
+        if (!sameUriRedirect && isStartUriMatched(ui, absoluteRequestUri)) {
             ClientTokenContext request = getClientTokenContext(rc);
             if (request != null) {
                 setClientCodeRequest(request);
@@ -118,9 +118,21 @@ public class ClientCodeRequestFilter implements ContainerRequestFilter
{
         }
     }
 
-    protected boolean isStartUriMatched(String absoluteRequestUri) {
-        return startUri.equals(WILDCARD) && (completeUri == null || !absoluteRequestUri.endsWith(completeUri))
-            || absoluteRequestUri.endsWith(startUri);
+    protected boolean isStartUriMatched(UriInfo ui, String absoluteRequestUri) {
+        if (startUri.equals(WILDCARD) && (completeUri == null || !absoluteRequestUri.endsWith(completeUri)))
{
+            return true;
+        }
+        if (!absoluteRequestUri.endsWith(startUri)) {
+            return false;
+        }
+        if (startUri.equals(completeUri)) {
+            MultivaluedMap<String, String> queries = ui.getQueryParameters();
+            if (queries.containsKey(OAuthConstants.AUTHORIZATION_CODE_VALUE) 
+                || queries.containsKey(OAuthConstants.ERROR_KEY)) {
+                return false;
+            }
+        }
+        return true;
     }
 
     protected void checkSecurityContextStart(ContainerRequestContext rc) {


Mime
View raw message