Author: jfrederic.clere(a)jboss.com
Date: 2008-03-14 13:36:31 -0400 (Fri, 14 Mar 2008)
New Revision: 506
Added:
sandbox/webapps/html/UTF8.jsp
sandbox/webapps/html/login.jsp
Modified:
sandbox/webapps/myapp.xml
Log:
Test the FORM based authentication.
Added: sandbox/webapps/html/UTF8.jsp
===================================================================
--- sandbox/webapps/html/UTF8.jsp (rev 0)
+++ sandbox/webapps/html/UTF8.jsp 2008-03-14 17:36:31 UTC (rev 506)
@@ -0,0 +1,38 @@
+<%@ page import="java.util.Enumeration" %>
+<%@ page import="java.util.Arrays" %>
+<%@ page language="java" session="false"
pageEncoding="UTF-8" contentType="text/html" %>
+<html>
+<head>
+ <title>Test page for UTF-8 URL-param decoding problem</title>
+
+ <meta http-equiv="content-type" content="text/html;
charset=UTF-8">
+ <meta http-equiv="Expires" content="0">
+ <meta http-equiv="Pragma" content="no-cache">
+ <meta http-equiv="Cache-Control" content="no-cache">
+</head>
+<body>
+Character encoding of the request: <%=request.getCharacterEncoding()%> <br/>
+Query Parameters: <%=request.getQueryString()%><br/>
+Decoded Parameters
+<table>
+ <thead>
+ <tr><tr><td>param
name</td><td>value</td></tr>
+ </thead>
+ <tbody>
+<%
+ Enumeration parameterNames = request.getParameterNames();
+ while (parameterNames.hasMoreElements()) {
+ String paramName = (String) parameterNames.nextElement();
+ String[] paramValues = request.getParameterValues(paramName);
+ String paramValuesString = Arrays.asList(paramValues).toString();
+%>
+ <tr>
+
<td><%=paramName%></td><td><%=paramValuesString%></td>
+ </tr>
+<%
+ }
+%>
+ </tbody>
+</table>
+</body>
+</html>
Added: sandbox/webapps/html/login.jsp
===================================================================
--- sandbox/webapps/html/login.jsp (rev 0)
+++ sandbox/webapps/html/login.jsp 2008-03-14 17:36:31 UTC (rev 506)
@@ -0,0 +1,20 @@
+<%@ page import="java.util.Enumeration" %>
+<%@ page import="java.util.Arrays" %>
+<%@ page language="java" session="false"
pageEncoding="UTF-8" contentType="text/html" %>
+<html>
+<head>
+ <title>Login page for UTF-8 URL-param decoding problem</title>
+
+ <meta http-equiv="content-type" content="text/html;
charset=UTF-8">
+ <meta http-equiv="Expires" content="0">
+ <meta http-equiv="Pragma" content="no-cache">
+ <meta http-equiv="Cache-Control" content="no-cache">
+</head>
+<body>
+<form method="POST" action="j_security_check">
+ <input type="text" name="j_username">
+ <input type="text" name="j_password">
+ <input type="submit" value="Log in">
+</form>
+</body>
+</html>
Modified: sandbox/webapps/myapp.xml
===================================================================
--- sandbox/webapps/myapp.xml 2008-03-14 17:27:06 UTC (rev 505)
+++ sandbox/webapps/myapp.xml 2008-03-14 17:36:31 UTC (rev 506)
@@ -150,20 +150,49 @@
<url-pattern>/TestDispatch</url-pattern>
</servlet-mapping>
-<!-- Filter -->
-<filter>
-<filter-name>TestFilter</filter-name>
-<filter-class>TestFilter</filter-class>
-<description>Test Filter</description>
-<init-param>
-<param-name>test</param-name>
-<param-value>ake</param-value>
-</init-param>
-</filter>
+ <!-- Filter -->
+ <filter>
+ <filter-name>TestFilter</filter-name>
+ <filter-class>TestFilter</filter-class>
+ <description>Test Filter</description>
+ <init-param>
+ <param-name>test</param-name>
+ <param-value>ake</param-value>
+ </init-param>
+ </filter>
-<filter-mapping>
-<filter-name>TestFilter</filter-name>
-<url-pattern>/*</url-pattern>
-</filter-mapping>
+ <filter-mapping>
+ <filter-name>TestFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <!-- Security testings -->
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Security Tests</web-resource-name>
+ <url-pattern>/UTF8.jsp</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>manager</role-name>
+ </auth-constraint>
+ </security-constraint>
+
+ <!-- Define the Login Configuration for this Application -->
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <realm-name>Tomcat Manager Application</realm-name>
+ <form-login-config>
+ <form-login-page>/login.jsp</form-login-page>
+ <form-error-page>/error/404.html</form-error-page>
+ </form-login-config>
+ </login-config>
+
+ <!-- Security roles referenced by this web application -->
+ <security-role>
+ <description>
+ The role that is required to log in to the Manager Application
+ </description>
+ <role-name>manager</role-name>
+ </security-role>
+
</web-app>