You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2015/08/17 17:47:14 UTC

[1/2] cxf-fediz git commit: Added Redirect Logout and fixed parent dependencies

Repository: cxf-fediz
Updated Branches:
  refs/heads/1.2.x-fixes fa101eb8f -> 42f597df3


Added Redirect Logout and fixed parent dependencies


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

Branch: refs/heads/1.2.x-fixes
Commit: b5af2a706ff031b2801399e300fbd8fe21a83bdd
Parents: fa101eb
Author: cschmuelling@talend.com <cs...@talend.com>
Authored: Mon Aug 17 14:32:09 2015 +0200
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon Aug 17 16:46:30 2015 +0100

----------------------------------------------------------------------
 examples/websphereWebapp/pom.xml                |  2 +-
 plugins/websphere/pom.xml                       |  7 ++--
 .../cxf/fediz/was/tai/FedizInterceptor.java     | 40 ++++++++++++--------
 systests/websphere/pom.xml                      |  2 +-
 4 files changed, 31 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b5af2a70/examples/websphereWebapp/pom.xml
----------------------------------------------------------------------
diff --git a/examples/websphereWebapp/pom.xml b/examples/websphereWebapp/pom.xml
index c57c8b9..9ce3c30 100644
--- a/examples/websphereWebapp/pom.xml
+++ b/examples/websphereWebapp/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.cxf.fediz</groupId>
         <artifactId>examples</artifactId>
-        <version>1.2.1-SNAPSHOT</version>
+        <version>1.2.2-SNAPSHOT</version>
     </parent>
 
     <groupId>org.apache.cxf.fediz.examples</groupId>

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b5af2a70/plugins/websphere/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/websphere/pom.xml b/plugins/websphere/pom.xml
index 68fc05e..2806ddf 100644
--- a/plugins/websphere/pom.xml
+++ b/plugins/websphere/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.cxf.fediz</groupId>
         <artifactId>plugin</artifactId>
-        <version>1.2.1-SNAPSHOT</version>
+        <version>1.2.2-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>fediz-websphere</artifactId>
@@ -35,8 +35,9 @@
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
-            <!--<version>${servlet.version}</version>-->
-            <version>3.1.0</version>
+            <!-- Servlet since version 3 supports logout.-->
+			<!--<version>${servlet.version}</version>-->
+            <version>3.0.1</version>
             <!--<type>jar</type>-->
             <!--<scope>compile</scope>-->
         </dependency>

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b5af2a70/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java
----------------------------------------------------------------------
diff --git a/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java b/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java
index e28439c..e63b3f8 100644
--- a/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java
+++ b/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java
@@ -77,8 +77,8 @@ public class FedizInterceptor implements TrustAssociationInterceptor {
     private String configFile;
     private FedizConfigurator configurator;
     private RoleToGroupMapper mapper;
-    private String cookieName;
-
+    private String cookieName = "LtpaToken2";
+    
     /**
      * @see org.apache.cxf.fediz.was.Constants#PROPERTY_KEY_DIRECT_GROUP_MAPPING
      */
@@ -256,8 +256,7 @@ public class FedizInterceptor implements TrustAssociationInterceptor {
                 Cookie[] cookies = req.getCookies();
                 if (cookies != null) {
                     for (Cookie c : cookies) {
-                        // TODO Make Cookie Name customizable
-                        if ("LtpaToken2".equals(c.getName())) {
+                        if (cookieName.equals(c.getName())) {
                             LOG.debug("User is already authenticated. Fediz TAI Interceptor will not be invoked");
                             isTargetInterceptor = false;
                             break;
@@ -313,10 +312,7 @@ public class FedizInterceptor implements TrustAssociationInterceptor {
 
                 @Override
                 protected boolean signoutCleanup(HttpServletRequest request, HttpServletResponse response) {
-                    HttpSession session = request.getSession();
-                    session.removeAttribute(Constants.SECURITY_TOKEN_SESSION_ATTRIBUTE_KEY);
-                    session.removeAttribute(Constants.SUBJECT_TOKEN_KEY);
-                    session.invalidate();
+                    terminateSession(request);
                     Cookie cookie = new Cookie(Constants.PROPERTY_SESSION_COOKIE_NAME, "");
                     cookie.setMaxAge(0);
                     response.addCookie(cookie);
@@ -324,23 +320,30 @@ public class FedizInterceptor implements TrustAssociationInterceptor {
                         request.logout();
                     } catch (ServletException e) {
                         LOG.error("Could not logout users");
-                        // e.printStackTrace();
                     }
-                    // WSSecurityHelper.revokeSSOCookies(request, response);
+                    FedizContext fedCtx = getFederationContext(request);
+                    String logoutRedirectUrl = fedCtx.getLogoutRedirectTo();
+                    String contextPath = request.getContextPath();
+                    try {
+                        if (logoutRedirectUrl != null && logoutRedirectUrl.length() > 0) {
+                            response.sendRedirect(contextPath + logoutRedirectUrl);
+                        } else {
+                            response.sendRedirect(contextPath);
+                        }
+                    } catch (IOException e) {
+                        LOG.error("Could not redirect to logout page");
+                    }
+                        
                     return super.signoutCleanup(request, response);
                 }
 
                 @Override
                 protected boolean signout(HttpServletRequest request, HttpServletResponse response) {
-                    HttpSession session = request.getSession();
-                    session.removeAttribute(Constants.SECURITY_TOKEN_SESSION_ATTRIBUTE_KEY);
-                    session.removeAttribute(Constants.SUBJECT_TOKEN_KEY);
-                    session.invalidate();
+                    terminateSession(request);
                     try {
                         request.logout();
                     } catch (ServletException e) {
                         LOG.error("Could not logout users");
-                        // e.printStackTrace();
                     }
                     return super.signout(request, response);
                 }
@@ -400,6 +403,13 @@ public class FedizInterceptor implements TrustAssociationInterceptor {
             throw new WebTrustAssociationFailedException(e.getMessage());
         }
     }
+    
+    protected void terminateSession(HttpServletRequest request) {
+        HttpSession session = request.getSession();
+        session.removeAttribute(Constants.SECURITY_TOKEN_SESSION_ATTRIBUTE_KEY);
+        session.removeAttribute(Constants.SUBJECT_TOKEN_KEY);
+        session.invalidate();
+    }
 
     protected void resumeRequest(HttpServletRequest request, HttpServletResponse response) {
         String wctx = request.getParameter(FederationConstants.PARAM_CONTEXT);

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b5af2a70/systests/websphere/pom.xml
----------------------------------------------------------------------
diff --git a/systests/websphere/pom.xml b/systests/websphere/pom.xml
index 153a80a..91f03df 100644
--- a/systests/websphere/pom.xml
+++ b/systests/websphere/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.cxf.fediz</groupId>
         <artifactId>fediz-systests</artifactId>
-        <version>1.2.1-SNAPSHOT</version>
+        <version>1.2.2-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <groupId>org.apache.cxf.fediz.systests</groupId>


[2/2] cxf-fediz git commit: removed redirect. redirect was wrong.

Posted by co...@apache.org.
removed redirect. redirect was wrong.


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

Branch: refs/heads/1.2.x-fixes
Commit: 42f597df37509481d12639b668816813a91d22c9
Parents: b5af2a7
Author: cschmuelling@talend.com <cs...@talend.com>
Authored: Mon Aug 17 15:07:03 2015 +0200
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon Aug 17 16:46:37 2015 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/fediz/was/tai/FedizInterceptor.java | 13 -------------
 1 file changed, 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/42f597df/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java
----------------------------------------------------------------------
diff --git a/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java b/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java
index e63b3f8..8e585c0 100644
--- a/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java
+++ b/plugins/websphere/src/main/java/org/apache/cxf/fediz/was/tai/FedizInterceptor.java
@@ -321,19 +321,6 @@ public class FedizInterceptor implements TrustAssociationInterceptor {
                     } catch (ServletException e) {
                         LOG.error("Could not logout users");
                     }
-                    FedizContext fedCtx = getFederationContext(request);
-                    String logoutRedirectUrl = fedCtx.getLogoutRedirectTo();
-                    String contextPath = request.getContextPath();
-                    try {
-                        if (logoutRedirectUrl != null && logoutRedirectUrl.length() > 0) {
-                            response.sendRedirect(contextPath + logoutRedirectUrl);
-                        } else {
-                            response.sendRedirect(contextPath);
-                        }
-                    } catch (IOException e) {
-                        LOG.error("Could not redirect to logout page");
-                    }
-                        
                     return super.signoutCleanup(request, response);
                 }