cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6165] Finalizing the demo
Date Tue, 07 Jul 2015 16:33:37 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 2604c6060 -> c6fcdcb1e


[CXF-6165] Finalizing the demo


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

Branch: refs/heads/3.0.x-fixes
Commit: c6fcdcb1ebf8c55cb3f6a8f22860030251fca1d8
Parents: 2604c60
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Jul 7 17:29:28 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Jul 7 17:32:42 2015 +0100

----------------------------------------------------------------------
 .../oidc/rp/OidcRpAuthenticationFilter.java     | 21 +++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c6fcdcb1/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcRpAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcRpAuthenticationFilter.java
b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcRpAuthenticationFilter.java
index 52df086..415e2cc 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcRpAuthenticationFilter.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcRpAuthenticationFilter.java
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.rs.security.oidc.rp;
 
+import java.net.URI;
+
 import javax.annotation.Priority;
 import javax.ws.rs.Priorities;
 import javax.ws.rs.container.ContainerRequestContext;
@@ -43,14 +45,23 @@ public class OidcRpAuthenticationFilter implements ContainerRequestFilter
{
     @Context
     private MessageContext mc;
     private ClientTokenContextManager stateManager;
-    private String rpServiceAddress;
+    private String redirectUri;
     
     public void filter(ContainerRequestContext rc) {
         if (checkSecurityContext(rc)) {
             return;
         } else {
-            UriBuilder ub = rc.getUriInfo().getBaseUriBuilder().path(rpServiceAddress);
-            rc.abortWith(Response.seeOther(ub.build())
+            URI redirectAddress = null;
+            if (redirectUri.startsWith("/")) {
+                String basePath = (String)mc.get("http.base.path");
+                redirectAddress = UriBuilder.fromUri(basePath).path(redirectUri).build();
+            } else if (redirectUri.startsWith("http")) {
+                redirectAddress = URI.create(redirectUri);
+            } else {
+                UriBuilder ub = rc.getUriInfo().getBaseUriBuilder().path(redirectUri);
+                redirectAddress = ub.build();
+            }
+            rc.abortWith(Response.seeOther(redirectAddress)
                            .header(HttpHeaders.CACHE_CONTROL, "no-cache, no-store")
                            .header("Pragma", "no-cache") 
                            .build());
@@ -80,8 +91,8 @@ public class OidcRpAuthenticationFilter implements ContainerRequestFilter
{
         }
         return requestState;
     }
-    public void setRpServiceAddress(String rpServiceAddress) {
-        this.rpServiceAddress = rpServiceAddress;
+    public void setRedirectUri(String redirectUri) {
+        this.redirectUri = redirectUri;
     }
     public void setStateManager(ClientTokenContextManager stateManager) {
         this.stateManager = stateManager;


Mime
View raw message