I use Spring Security 3 and JSF2 Primefaces. Then, I create a index.xhtml for welcome page and login.xhtml for login page
When I access the root web site, it redirect me to login.xhtml page. Why not?
How to set the welcome page to index.xhtml
This is web.xml
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
This is spring-security.xml
<global-method-security secured-annotations="enabled"
jsr250-annotations="enabled" />
<!-- Resource Security -->
<http access-denied-page="/accessDenied.jsp">
<intercept-url pattern="/pages/**" access="ROLE_ADMIN" />
<form-login login-page="/login.jsf" default-target-url="/pages/index.jsf" />
<logout logout-success-url="/login.jsf" invalidate-session="true" />
<session-management invalid-session-url="/login.jsf">
<concurrency-control max-sessions="10"
error-if-maximum-exceeded="true" />
</session-management>
</http>
For a basic application with JSF, Spring and Spring-Security, you need to configure your web.xml as follows:
and also configure faces-config.xml as follows:
and your applicationContext-security.xml as follows:
Finally, if you have any spring beans, your applicationContext.xml for annotation based configuration will be:
and annotate your beans like this:
So with all these in place along with your pages there should be no problem.