Author: nbelaevski
Date: 2009-03-18 15:56:12 -0400 (Wed, 18 Mar 2009)
New Revision: 13012
Added:
trunk/samples/functions-demo/src/main/webapp/pages/error.html
trunk/samples/functions-demo/src/main/webapp/pages/login.html
Modified:
trunk/samples/functions-demo/src/main/webapp/WEB-INF/web.xml
trunk/samples/functions-demo/src/main/webapp/index.jsp
trunk/samples/functions-demo/src/main/webapp/pages/index.jsp
trunk/samples/functions-demo/src/main/webapp/pages/index.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-6551
Modified: trunk/samples/functions-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/functions-demo/src/main/webapp/WEB-INF/web.xml 2009-03-18 19:56:01 UTC
(rev 13011)
+++ trunk/samples/functions-demo/src/main/webapp/WEB-INF/web.xml 2009-03-18 19:56:12 UTC
(rev 13012)
@@ -1,61 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <display-name>Archetype Created Web Application</display-name>
- <context-param>
- <param-name>javax.faces.CONFIG_FILES</param-name>
- <param-value>/WEB-INF/faces-config.xml</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
- </context-param>
- <!-- Use Documents Saved as *.xhtml -->
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.jsp</param-value>
- </context-param>
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>Archetype Created Web Application</display-name>
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <!-- Use Documents Saved as *.xhtml -->
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.jsp</param-value>
+ </context-param>
- <!-- Facelets pages will use the .xhtml extension -->
- <context-param>
- <param-name>facelets.VIEW_MAPPINGS</param-name>
- <param-value>*xhtml</param-value>
- </context-param>
-
- <context-param>
- <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
- <param-value>com.sun.facelets.FaceletViewHandler</param-value>
- </context-param>
+ <!-- Facelets pages will use the .xhtml extension -->
+ <context-param>
+ <param-name>facelets.VIEW_MAPPINGS</param-name>
+ <param-value>*xhtml</param-value>
+ </context-param>
- <!--
- -->
- <filter>
- <display-name>Ajax4jsf Filter</display-name>
- <filter-name>ajax4jsf</filter-name>
- <filter-class>org.ajax4jsf.Filter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>ajax4jsf</filter-name>
- <servlet-name>Faces Servlet</servlet-name>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>INCLUDE</dispatcher>
- <dispatcher>ERROR</dispatcher>
- </filter-mapping>
- <!-- Faces Servlet -->
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- </servlet>
-
- <!-- Use prefix mapping for Facelets pages, e.g.
http://localhost:8080/webapp/faces/mypage.xhtml -->
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
+ <context-param>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+ <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+ </context-param>
-
- <login-config>
- <auth-method>BASIC</auth-method>
- </login-config>
+ <!--
+ -->
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ <dispatcher>ERROR</dispatcher>
+ </filter-mapping>
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ </servlet>
+
+ <!--
+ Use prefix mapping for Facelets pages, e.g.
+
http://localhost:8080/webapp/faces/mypage.xhtml
+ -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces-auth/*</url-pattern>
+ </servlet-mapping>
+
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <form-login-config>
+ <form-login-page>/pages/login.html</form-login-page>
+ <form-error-page>/pages/error.html</form-error-page>
+ </form-login-config>
+ </login-config>
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>faces-auth</web-resource-name>
+ <url-pattern>/faces-auth/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>user</role-name>
+ <role-name>admin</role-name>
+ </auth-constraint>
+ </security-constraint>
</web-app>
Modified: trunk/samples/functions-demo/src/main/webapp/index.jsp
===================================================================
--- trunk/samples/functions-demo/src/main/webapp/index.jsp 2009-03-18 19:56:01 UTC (rev
13011)
+++ trunk/samples/functions-demo/src/main/webapp/index.jsp 2009-03-18 19:56:12 UTC (rev
13012)
@@ -6,7 +6,9 @@
<body>
<a href="faces/pages/index.jsp">JSP</a><br/>
- <a href="faces/pages/index.xhtml">Facelets</a>
+ <a href="faces-auth/pages/index.jsp">JSP
authenticated</a><br/>
+ <a href="faces/pages/index.xhtml">Facelets</a><br />
+ <a href="faces-auth/pages/index.xhtml">Facelets
authenticated</a>
</body>
</html>
\ No newline at end of file
Added: trunk/samples/functions-demo/src/main/webapp/pages/error.html
===================================================================
--- trunk/samples/functions-demo/src/main/webapp/pages/error.html
(rev 0)
+++ trunk/samples/functions-demo/src/main/webapp/pages/error.html 2009-03-18 19:56:12 UTC
(rev 13012)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/>
+<title>Login failed</title>
+</head>
+<body>
+Login failed
+</body>
+</html>
\ No newline at end of file
Modified: trunk/samples/functions-demo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/functions-demo/src/main/webapp/pages/index.jsp 2009-03-18 19:56:01 UTC
(rev 13011)
+++ trunk/samples/functions-demo/src/main/webapp/pages/index.jsp 2009-03-18 19:56:12 UTC
(rev 13012)
@@ -21,6 +21,16 @@
<br />
<h:outputText value="#{fn:findComponent('input').value}" />
<br />
+
+ Roles:
+ <h:outputText rendered="#{fn:isUserInRole('admin, user')}"
value="admin/user" />
+ <br />
+ <h:outputText rendered="#{fn:isUserInRole('admin')}"
value="admin" />
+ <br />
+ <h:outputText rendered="#{fn:isUserInRole('user')}"
value="user" />
+ <br />
+
+
</f:view>
</body>
</html>
Modified: trunk/samples/functions-demo/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/samples/functions-demo/src/main/webapp/pages/index.xhtml 2009-03-18 19:56:01 UTC
(rev 13011)
+++ trunk/samples/functions-demo/src/main/webapp/pages/index.xhtml 2009-03-18 19:56:12 UTC
(rev 13012)
@@ -20,5 +20,14 @@
<br />
<h:outputText value="#{fn:findComponent('input').value}" />
<br />
+
+ Roles:
+ <h:outputText rendered="#{fn:isUserInRole('admin, user')}"
value="admin/user" />
+ <br />
+ <h:outputText rendered="#{fn:isUserInRole('admin')}"
value="admin" />
+ <br />
+ <h:outputText rendered="#{fn:isUserInRole('user')}"
value="user" />
+ <br />
+
</f:view>
</html>
\ No newline at end of file
Added: trunk/samples/functions-demo/src/main/webapp/pages/login.html
===================================================================
--- trunk/samples/functions-demo/src/main/webapp/pages/login.html
(rev 0)
+++ trunk/samples/functions-demo/src/main/webapp/pages/login.html 2009-03-18 19:56:12 UTC
(rev 13012)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/>
+<title>Insert title here</title>
+</head>
+<body>
+ <form action="j_security_check" method="post">
+ <input type="text" name="j_username" />
+ <br />
+ <input type="password" name="j_password" />
+ <br />
+ <input type="submit" value="Login" />
+ </form>
+</body>
+</html>
\ No newline at end of file