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:46:22 UTC

[1/2] cxf-fediz git commit: [FEDIZ-128] - Parent POM dependencies wrong in Websphere artifacts. Thanks to Christian Schmulling for the patch.

Repository: cxf-fediz
Updated Branches:
  refs/heads/master 34d160e3b -> 3c4652b09


[FEDIZ-128] - Parent POM dependencies wrong in Websphere artifacts. Thanks to Christian Schmulling for the patch.


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

Branch: refs/heads/master
Commit: c369c076abb7a6432d2bf06cfea0d7cf70b0767b
Parents: 34d160e
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon Aug 17 16:45:09 2015 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon Aug 17 16:45:09 2015 +0100

----------------------------------------------------------------------
 examples/websphereWebapp/pom.xml                |  2 +-
 .../cxf/fediz/was/tai/FedizInterceptor.java     | 40 ++++++++++++--------
 2 files changed, 26 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/c369c076/examples/websphereWebapp/pom.xml
----------------------------------------------------------------------
diff --git a/examples/websphereWebapp/pom.xml b/examples/websphereWebapp/pom.xml
index c57c8b9..da695b0 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.3.0-SNAPSHOT</version>
     </parent>
 
     <groupId>org.apache.cxf.fediz.examples</groupId>

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/c369c076/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 0bd9ae0..ce88185 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);


[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/3c4652b0
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/3c4652b0
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/3c4652b0

Branch: refs/heads/master
Commit: 3c4652b09d793d7b9e839fd604992b566633bc1c
Parents: c369c07
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:45:39 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/3c4652b0/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 ce88185..c7a28de 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);
                 }