Opa, pesquisei demais e resolvi me cadastrar no forum para que alguém me dê uma luz!
É o seguinte implementei o login usando o JAAS, mas quando clico em logar ele redireciona para a página:
http://localhost:8080/Projeto/javax.faces.resource/theme.css.jsf?ln=primefaces-flick
e não para:
http://localhost:8080/Projeto/index.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>Projeto</display-name>
<welcome-file-list>
<welcome-file>/index.xhtml</welcome-file>
</welcome-file-list>
<!-- Faces Mapping -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<!-- Error Pages -->
<error-page>
<error-code>404</error-code>
<location>/pages/error/404.jsf</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/pages/error/403.jsf</location>
</error-page>
<!-- Prime Themes -->
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>flick</param-value>
</context-param>
<!-- File Upload -->
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- Protected Areas -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Users and admins</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>ADMIN</role-name>
<role-name>USER</role-name>
</auth-constraint>
</security-constraint>
<!-- Validation By Form -->
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsf</form-login-page>
<form-error-page>/pages/error/loginError.jsf</form-error-page>
</form-login-config>
</login-config>
<!-- Allowed Roles -->
<security-role>
<role-name>ADMIN</role-name>
</security-role>
<security-role>
<role-name>USER</role-name>
</security-role>
<!-- Filter to get the user name and work with it -->
<filter>
<filter-name>LoginFilter</filter-name>
<filter-class>party.filters.LoginFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LoginFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Login</title>
</h:head>
<h:body>
<p>Login to access secure pages:</p>
<form method="post" action="j_security_check">
<h:panelGrid columns="2">
<h:outputLabel for="j_username" value="Username:" />
<h:inputText id="j_username" name="j_username" />
<h:outputLabel for="j_password" value="Password" />
<h:inputSecret id="j_password" name="j_password" />
<input type="submit" name="submit" value="Login" />
</h:panelGrid>
</form>
</h:body>
</html>
