Currently using: JBoss 6 (Development on GlassFish 3.1), JSF 2.0, form-based authentication with JAAS (no “public” pages, everything needs authentication).
The web application provides two different search pages (like search1.jsf and search2.jsf), accessible from index.jsf, but for users which do not belong to a special role with additional rights, search2.jsf must not be accessible.
The “standard” way to protect search2.jsf would be a configuration in web.xml which requires the special user role for this page. Are there other ways to protect the second search page dynamically, either based on a role or based on user-specific attributes, which do not introduce additional authentication frameworks or container-specific features?
Disabling the link in index.jsf which points to search2.jsf is easy, but users could enter the URL of the second search page in the browser to see it (so for the prototype I will adjust web.xml).
You can use EL in
<ui:include>. Create a public mastersearch.xhtmlpage which includes eithersearch1.xhtmlorsearch2.xhtmldepending on the user role.E.g.
(Those include files are put in
/WEB-INFso that the client cannot request it directly)Then open the page by just
search.xhtmlinstead.