[jboss-cvs] JBossAS SVN: r63267 - in branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security: custom-principal and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed May 30 18:03:52 EDT 2007
Author: scott.stark at jboss.org
Date: 2007-05-30 18:03:52 -0400 (Wed, 30 May 2007)
New Revision: 63267
Added:
branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/
branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/WEB-INF/
branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/WEB-INF/jboss-web.xml
branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/WEB-INF/web.xml
branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/errorpage.jsp
branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/index.jsp
branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/login.jsp
branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/loginError.jsp
branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/throwerror.jsp
Log:
ASPATCH-156, start adding the tests for the issue
Added: branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/WEB-INF/jboss-web.xml
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/WEB-INF/jboss-web.xml (rev 0)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/WEB-INF/jboss-web.xml 2007-05-30 22:03:52 UTC (rev 63267)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss-web
+ PUBLIC "-//JBoss//DTD Web Application 2.4//EN"
+ "http://www.jboss.org/j2ee/dtds/jboss-web_4_0.dtd">
+<jboss-web>
+ <security-domain>java:/jaas/jaas-testpropagation</security-domain>
+</jboss-web>
Added: branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/WEB-INF/web.xml
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/WEB-INF/web.xml (rev 0)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/WEB-INF/web.xml 2007-05-30 22:03:52 UTC (rev 63267)
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <display-name>Custom Principal Propagation Test</display-name>
+ <welcome-file-list>
+ <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>
+ <http-method>GET</http-method>
+ <http-method>POST</http-method>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>Echo</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <description>no description</description>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <realm-name>CustomPrincipalPropagation</realm-name>
+ <form-login-config>
+ <form-login-page>/login.jsp</form-login-page>
+ <form-error-page>/loginError.jsp</form-error-page>
+ </form-login-config>
+ </login-config>
+
+ <security-role>
+ <role-name>Echo</role-name>
+ </security-role>
+</web-app>
Added: branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/errorpage.jsp
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/errorpage.jsp (rev 0)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/errorpage.jsp 2007-05-30 22:03:52 UTC (rev 63267)
@@ -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>
Added: branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/index.jsp
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/index.jsp (rev 0)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/index.jsp 2007-05-30 22:03:52 UTC (rev 63267)
@@ -0,0 +1,24 @@
+<%@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
+ {
+ InitialContext ic = new InitialContext();
+ Object obj = ic.lookup("jaas.CustomPrincipalPropagation");
+ obj = PortableRemoteObject.narrow(obj, CustomPrincipalHome.class);
+ CustomPrincipalHome home = (CustomPrincipalHome) obj;
+ CustomPrincipal bean = home.create();
+ isCustomType = bean.validateCallerPrincipal(CustomPrincipalImpl.class);
+ bean.remove();
+ }
+ catch(Exception e)
+ {
+ throw new IllegalStateException(e.getMessage());
+ }
+ if(!isCustomType)
+ throw new IllegalStateException("Custom Principal not seen");
+ out.println("Propagation Success");
+%>
Added: branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/login.jsp
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/login.jsp (rev 0)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/login.jsp 2007-05-30 22:03:52 UTC (rev 63267)
@@ -0,0 +1,15 @@
+<html>
+<body>
+ <form action="j_security_check" method="post" id="login">
+ <p>
+ User ID: <input type="text" size="20" name="j_username" id="user
+name_id"/>
+ <br>
+ Password: <input type="password" size="20" name="j_password"/>
+ <br>
+ <br>
+ <input type="submit" value="submit">
+ </p>
+ </form>
+</body>
+</html>
Added: branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/loginError.jsp
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/loginError.jsp (rev 0)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/loginError.jsp 2007-05-30 22:03:52 UTC (rev 63267)
@@ -0,0 +1 @@
+Encountered a login error!!
Added: branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/throwerror.jsp
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/throwerror.jsp (rev 0)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/resources/security/custom-principal/throwerror.jsp 2007-05-30 22:03:52 UTC (rev 63267)
@@ -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