[jboss-cvs] JBossAS SVN: r60103 - in branches/Branch_4_2/testsuite/src/resources/security: custom-principal and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jan 29 09:50:23 EST 2007
Author: scott.stark at jboss.org
Date: 2007-01-29 09:50:23 -0500 (Mon, 29 Jan 2007)
New Revision: 60103
Added:
branches/Branch_4_2/testsuite/src/resources/security/custom-principal/
branches/Branch_4_2/testsuite/src/resources/security/custom-principal/errorpage.jsp
branches/Branch_4_2/testsuite/src/resources/security/custom-principal/throwerror.jsp
Modified:
branches/Branch_4_2/testsuite/src/resources/security/custom-principal/WEB-INF/web.xml
branches/Branch_4_2/testsuite/src/resources/security/custom-principal/index.jsp
Log:
JBAS-1537, add tests of custom principal in error pages
Copied: branches/Branch_4_2/testsuite/src/resources/security/custom-principal (from rev 60026, branches/Branch_4_2/testsuite/src/resources/web/custom-principal)
Modified: branches/Branch_4_2/testsuite/src/resources/security/custom-principal/WEB-INF/web.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/web/custom-principal/WEB-INF/web.xml 2007-01-26 16:58:34 UTC (rev 60026)
+++ branches/Branch_4_2/testsuite/src/resources/security/custom-principal/WEB-INF/web.xml 2007-01-29 14:50:23 UTC (rev 60103)
@@ -8,8 +8,29 @@
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
+ <error-page>
+ <error-code>403</error-code>
+ <location>/errorpage.jsp</location>
+ </error-page>
+
<security-constraint>
<web-resource-collection>
+ <web-resource-name>No access</web-resource-name>
+ <description>Content with no access</description>
+ <url-pattern>/noaccess/*</url-pattern>
+ <http-method>GET</http-method>
+ <http-method>POST</http-method>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name />
+ </auth-constraint>
+ <user-data-constraint>
+ <description>no description</description>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+ <security-constraint>
+ <web-resource-collection>
<web-resource-name>allJspPages</web-resource-name>
<description>All JSP Pages</description>
<url-pattern>*.jsp</url-pattern>
@@ -26,7 +47,7 @@
</security-constraint>
<login-config>
- <auth-method>FORM</auth-method>
+ <auth-method>BASIC</auth-method>
<realm-name>CustomPrincipalPropagation</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
Added: branches/Branch_4_2/testsuite/src/resources/security/custom-principal/errorpage.jsp
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/security/custom-principal/errorpage.jsp (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/security/custom-principal/errorpage.jsp 2007-01-29 14:50:23 UTC (rev 60103)
@@ -0,0 +1,23 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page import="java.security.Principal" %>
+<%@ page isErrorPage="true" %>
+<html>
+<head>
+ <title>Error Page</title>
+</head>
+<body bgcolor="white">
+
+Error caused by uri: <%= pageContext.getErrorData().getRequestURI() %><br>
+Error in servlet=: <%= pageContext.getErrorData().getServletName() %><br>
+Status code: <%= pageContext.getErrorData().getStatusCode() %><br>
+Throwable : <%= pageContext.getErrorData().getRequestURI() %><br>
+<%
+ Principal userPrincipal = request.getUserPrincipal();
+ String userPrincipalClass = userPrincipal != null ? userPrincipal.getClass().getName() : "none";
+ response.addHeader("X-UserPrincipal", userPrincipal.toString());
+ response.addHeader("X-UserPrincipalClass", userPrincipalClass);
+%>
+RequestPrincipal: <%= userPrincipal%><br>
+RequestPrincipalClass: <%= userPrincipalClass%><br>
+</body>
+</html>
Modified: branches/Branch_4_2/testsuite/src/resources/security/custom-principal/index.jsp
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/web/custom-principal/index.jsp 2007-01-26 16:58:34 UTC (rev 60026)
+++ branches/Branch_4_2/testsuite/src/resources/security/custom-principal/index.jsp 2007-01-29 14:50:23 UTC (rev 60103)
@@ -1,6 +1,7 @@
<%@page import="javax.naming.InitialContext,javax.rmi.PortableRemoteObject,org.jboss.test.security.interfaces.CustomPrincipalHome,org.jboss.test.security.interfaces.CustomPrincipal,org.jboss.test.security.ejb.CustomPrincipalImpl"
%>
+
<%
boolean isCustomType = false;
try
Added: branches/Branch_4_2/testsuite/src/resources/security/custom-principal/throwerror.jsp
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/security/custom-principal/throwerror.jsp (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/security/custom-principal/throwerror.jsp 2007-01-29 14:50:23 UTC (rev 60103)
@@ -0,0 +1,6 @@
+<%@page import="java.security.Principal" %>
+<%@page errorPage="errorpage.jsp?debug=log" %>
+<%
+ if( true )
+ throw new IllegalStateException("throwerror.jsp caused this");
+%>
More information about the jboss-cvs-commits
mailing list