cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1415155 - in /cxf/fediz/trunk/services/idp/src/main: java/org/apache/cxf/fediz/service/idp/FederationPostFilter.java webapp/WEB-INF/web.xml
Date Thu, 29 Nov 2012 13:18:36 GMT
Author: owulff
Date: Thu Nov 29 13:18:35 2012
New Revision: 1415155

URL: http://svn.apache.org/viewvc?rev=1415155&view=rev
Log:
Removed JSP dependency in IDP

Modified:
    cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/FederationPostFilter.java
    cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml

Modified: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/FederationPostFilter.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/FederationPostFilter.java?rev=1415155&r1=1415154&r2=1415155&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/FederationPostFilter.java
(original)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/FederationPostFilter.java
Thu Nov 29 13:18:35 2012
@@ -19,6 +19,7 @@
 package org.apache.cxf.fediz.service.idp;
 
 import java.io.IOException;
+import java.io.PrintWriter;
 
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletException;
@@ -90,11 +91,46 @@ public class FederationPostFilter extend
             throw new ProcessingException("Requesting security token failed");          
         }
 
-        LOG.debug("Forward to jsp...");
-        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, private");
-        request.getRequestDispatcher("/WEB-INF/signinresponse.jsp")
-            .forward(request, response);
+        setResponseBody(request, response);
+        context.put(AbstractAuthFilter.PROCESSING_STATE, AbstractAuthFilter.ProcessingState.SEND_RESPONSE);
 
     }
-
+    
+    private void setResponseBody(HttpServletRequest request, HttpServletResponse response)
{
+        
+        try {
+            response.setContentType("text/html");
+            PrintWriter out = response.getWriter();
+            
+            out.println("<html>");
+            out.println("<head><title>IDP SignIn Response Form</title></head>");
+            out.println("<body>");
+            out.println("<form method=\"POST\" name=\"hiddenform\" action=\"" 
+                        + request.getAttribute("fed.action") + "\">");
+            out.println("<input type=\"hidden\" name=\"wa\" value=\"wsignin1.0\" />");
+            out.println("<input type=\"hidden\" name=\"wresult\" value=\"" 
+                        + request.getAttribute("fed.wresult") + "\"/>");
+            out.println("<input type=\"hidden\" name=\"wctx\" value=\"" 
+                        + request.getAttribute("fed.wctx") + "\"/>");
+            out.println("<noscript>");
+            out.println("<p>Script is disabled. Click Submit to continue.</p>");
+            out.println("<input type=\"submit\" value=\"Submit\" />");
+            out.println("</noscript>");
+            out.println("</form>");
+            out.println("<script language=\"javascript\">window.setTimeout('document.forms[0].submit()',0);</script>");
+            out.println("</body>");
+            out.println("</html>");
+            
+        } catch (IOException ex) {
+            LOG.error("Failed to create SignInResponse message", ex);
+            try {
+                response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
+                                   "Failed to create SignInResponse message");
+            } catch (IOException e) {
+                LOG.error("Failed to write error reponse", e);
+            }
+        }
+        
+    }
 }
+

Modified: cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml?rev=1415155&r1=1415154&r2=1415155&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml (original)
+++ cxf/fediz/trunk/services/idp/src/main/webapp/WEB-INF/web.xml Thu Nov 29 13:18:35 2012
@@ -207,11 +207,6 @@
 		<filter-name>AuthenticationFilter</filter-name>
 		<url-pattern>/*</url-pattern>
 	</filter-mapping>
-	
-	<filter-mapping>
-		<filter-name>FederationFilter</filter-name>
-		<url-pattern>/*</url-pattern>
-	</filter-mapping>
 
 	<filter-mapping>
 		<filter-name>BasicAuthenticationFilter</filter-name>



Mime
View raw message