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 <cohei...@apache.org>
Authored: Mon Aug 17 16:45:09 2015 +0100
Committer: Colm O hEigeartaigh <cohei...@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);

Reply via email to