cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1453535 - in /cxf/fediz/trunk: plugins/spring/src/main/java/org/apache/cxf/fediz/spring/preauth/ systests/simpleWebapp/src/main/java/org/apache/cxf/fediz/example/ systests/springPreauthWebapp/src/main/java/org/apache/cxf/fediz/example/ sys...
Date Wed, 06 Mar 2013 20:23:41 GMT
Author: owulff
Date: Wed Mar  6 20:23:41 2013
New Revision: 1453535

URL: http://svn.apache.org/r1453535
Log:
Integration test for login token access in FederationPrincipal

Modified:
    cxf/fediz/trunk/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/preauth/FederationPreAuthenticatedProcessingFilter.java
    cxf/fediz/trunk/systests/simpleWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
    cxf/fediz/trunk/systests/springPreauthWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
    cxf/fediz/trunk/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java

Modified: cxf/fediz/trunk/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/preauth/FederationPreAuthenticatedProcessingFilter.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/preauth/FederationPreAuthenticatedProcessingFilter.java?rev=1453535&r1=1453534&r2=1453535&view=diff
==============================================================================
--- cxf/fediz/trunk/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/preauth/FederationPreAuthenticatedProcessingFilter.java
(original)
+++ cxf/fediz/trunk/plugins/spring/src/main/java/org/apache/cxf/fediz/spring/preauth/FederationPreAuthenticatedProcessingFilter.java
Wed Mar  6 20:23:41 2013
@@ -29,9 +29,6 @@ import org.springframework.security.web.
  * J2EE container-based authentication mechanism. It will use the J2EE user
  * principal name as the pre-authenticated principal and the WS-Federation signin request
  * as the credentials.
- *
- * @author Ruud Senden
- * @since 2.0
  */
 public class FederationPreAuthenticatedProcessingFilter extends AbstractPreAuthenticatedProcessingFilter
{
 

Modified: cxf/fediz/trunk/systests/simpleWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/simpleWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java?rev=1453535&r1=1453534&r2=1453535&view=diff
==============================================================================
--- cxf/fediz/trunk/systests/simpleWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
(original)
+++ cxf/fediz/trunk/systests/simpleWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
Wed Mar  6 20:23:41 2013
@@ -30,9 +30,12 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.w3c.dom.Element;
+
 import org.apache.cxf.fediz.core.Claim;
 import org.apache.cxf.fediz.core.ClaimCollection;
 import org.apache.cxf.fediz.core.FederationPrincipal;
+import org.apache.cxf.fediz.cxf.web.SecurityTokenThreadLocal;
 
 
 public class FederationServlet extends HttpServlet {
@@ -72,6 +75,17 @@ public class FederationServlet extends H
             for (Claim c: claims) {
                 out.println("<p>" + c.getClaimType().toString() + "=" + c.getValue()
+ "</p>");
             }
+            
+            Element el = fp.getLoginToken();
+            if (el != null) {
+                out.println("loginToken=FOUND{FederationPrincipal}<p>");
+            }
+            
+            el = SecurityTokenThreadLocal.getToken();
+            if (el != null) {
+                out.println("loginToken=FOUND{SecurityTokenThreadLocal}<p>");
+            }
+            
         }
         
         out.println("</body>");

Modified: cxf/fediz/trunk/systests/springPreauthWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/springPreauthWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java?rev=1453535&r1=1453534&r2=1453535&view=diff
==============================================================================
--- cxf/fediz/trunk/systests/springPreauthWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
(original)
+++ cxf/fediz/trunk/systests/springPreauthWebapp/src/main/java/org/apache/cxf/fediz/example/FederationServlet.java
Wed Mar  6 20:23:41 2013
@@ -30,9 +30,12 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.w3c.dom.Element;
+
 import org.apache.cxf.fediz.core.Claim;
 import org.apache.cxf.fediz.core.ClaimCollection;
 import org.apache.cxf.fediz.core.FederationPrincipal;
+import org.apache.cxf.fediz.cxf.web.SecurityTokenThreadLocal;
 
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
@@ -75,6 +78,16 @@ public class FederationServlet extends H
             for (Claim c : claims) {
                 out.println("<p>" + c.getClaimType().toString() + "=" + c.getValue()
+ "</p>");
             }
+            
+            Element el = fp.getLoginToken();
+            if (el != null) {
+                out.println("loginToken=FOUND{FederationPrincipal}<p>");
+            }
+            
+            el = SecurityTokenThreadLocal.getToken();
+            if (el != null) {
+                out.println("loginToken=FOUND{SecurityTokenThreadLocal}<p>");
+            }
         }
         
         out.println("</body>");

Modified: cxf/fediz/trunk/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java?rev=1453535&r1=1453534&r2=1453535&view=diff
==============================================================================
--- cxf/fediz/trunk/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
(original)
+++ cxf/fediz/trunk/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
Wed Mar  6 20:23:41 2013
@@ -79,6 +79,12 @@ public abstract class AbstractTests {
         claim = ClaimTypes.EMAILADDRESS.toString();
         Assert.assertTrue("User " + user + " claim " + claim + " is not 'alice@mycompany.org'",
                           response.indexOf(claim + "=alice@mycompany.org") > 0);
+        
+        Assert.assertTrue("Login token missing in SecurityTokenThreadLocal",
+                          response.indexOf("loginToken=FOUND{SecurityTokenThreadLocal}")
> 0);
+        
+        Assert.assertTrue("Login token missing in SecurityTokenThreadLocal",
+                          response.indexOf("loginToken=FOUND{FederationPrincipal}") >
0);
 
     }
 
@@ -103,6 +109,12 @@ public abstract class AbstractTests {
         claim = ClaimTypes.EMAILADDRESS.toString();
         Assert.assertTrue("User " + user + " claim " + claim + " is not 'bobwindsor@idp.org'",
                           response.indexOf(claim + "=bobwindsor@idp.org") > 0);
+        
+        Assert.assertTrue("Login token missing in SecurityTokenThreadLocal",
+                          response.indexOf("loginToken=FOUND{SecurityTokenThreadLocal}")
> 0);
+        
+        Assert.assertTrue("Login token missing in SecurityTokenThreadLocal",
+                          response.indexOf("loginToken=FOUND{FederationPrincipal}") >
0);
     }
 
     @org.junit.Test
@@ -126,6 +138,12 @@ public abstract class AbstractTests {
         claim = ClaimTypes.EMAILADDRESS.toString();
         Assert.assertTrue("User " + user + " claim " + claim + " is not 'tcooper@hereiam.org'",
                           response.indexOf(claim + "=tcooper@hereiam.org") > 0);
+        
+        Assert.assertTrue("Login token missing in SecurityTokenThreadLocal",
+                          response.indexOf("loginToken=FOUND{SecurityTokenThreadLocal}")
> 0);
+        
+        Assert.assertTrue("Login token missing in SecurityTokenThreadLocal",
+                          response.indexOf("loginToken=FOUND{FederationPrincipal}") >
0);
     }
 
     @org.junit.Test



Mime
View raw message