cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Another update to ClientCodeRequestFilter
Date Tue, 19 Jul 2016 09:39:31 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 998b35ea2 -> 945daf7e5


Another update to ClientCodeRequestFilter


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

Branch: refs/heads/3.1.x-fixes
Commit: 945daf7e52fc754b6d3e700444cc5619cdc1a800
Parents: 998b35e
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Tue Jul 19 12:37:22 2016 +0300
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Tue Jul 19 12:39:13 2016 +0300

----------------------------------------------------------------------
 .../security/oauth2/client/ClientCodeRequestFilter.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/945daf7e/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 deefe61..54efb3d 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
@@ -83,15 +83,16 @@ public class ClientCodeRequestFilter implements ContainerRequestFilter
{
         checkSecurityContextStart(rc);
         UriInfo ui = rc.getUriInfo();
         String absoluteRequestUri = ui.getAbsolutePath().toString();
-        
+        boolean sameRedirectUri = false;
         if (completeUri == null) {
             String referer = rc.getHeaderString("Referer");
             if (referer != null && referer.startsWith(authorizationServiceUri)) {
                 completeUri = absoluteRequestUri;
+                sameRedirectUri = true;
             } 
         }
         
-        if (isStartUriMatched(ui, absoluteRequestUri)) {
+        if (isStartUriMatched(ui, absoluteRequestUri, sameRedirectUri)) {
             ClientTokenContext request = getClientTokenContext(rc);
             if (request != null) {
                 setClientCodeRequest(request);
@@ -120,10 +121,11 @@ public class ClientCodeRequestFilter implements ContainerRequestFilter
{
         rc.abortWith(Response.status(401).build());
     }
 
-    protected boolean isStartUriMatched(UriInfo ui, String absoluteRequestUri) {
+    protected boolean isStartUriMatched(UriInfo ui, String absoluteRequestUri, boolean sameRedirectUri)
{
         // If all request URIs can initiate a code flow then it is a match 
         // unless the current request URI matches a non-null completeUri 
-        if (startUri == null && completeUri != null && !absoluteRequestUri.endsWith(completeUri))
{
+        if (startUri == null 
+            && (completeUri != null && !absoluteRequestUri.endsWith(completeUri)
|| !sameRedirectUri)) {
             return true;
         }
         // If completeUri is null or startUri equals to it then check the code flow


Mime
View raw message