title: spring security login
body: <p>i'm developing login page with spring security but when I start my project automatically redirected to the login page. I've a  in my web.xml with redirect to index.xhtml, why is redirect to login.xhtml?</p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;web-app &gt;
  &lt;display-name&gt;AirTour&lt;/display-name&gt;
  
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.xhtml&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  
  &lt;!-- SPRING --&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
          /WEB-INF/conf/applicationContext.xml
       &lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;!-- SPRING SECURITY  --&gt;
  
  
  &lt;filter&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  
  
  &lt;!-- JSF --&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt;
      &lt;param-value&gt;Development&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>applicationContext.xml</p>
  
  <pre><code>&lt;bean id="userDetailsManager" class="org.springframework.security.provisioning.JdbcUserDetailsManager"&gt;
      &lt;property name="dataSource" ref="dataSource"&gt;&lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"/&gt;
  
  &lt;bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource"&gt;
      &lt;property name="userPropertyToUse" value="username"/&gt;
  &lt;/bean&gt;
  
  
  
  &lt;security:authentication-manager alias="authenticationManager"&gt;
          &lt;security:authentication-provider user-service-ref="userDetailsManager"&gt;
          &lt;security:password-encoder ref="passwordEncoder"&gt;
              &lt;security:salt-source ref="saltSource"/&gt;
          &lt;/security:password-encoder&gt;
         &lt;/security:authentication-provider&gt;
  &lt;/security:authentication-manager&gt;
  
  &lt;security:http  &gt;
      &lt;security:intercept-url pattern="/user/*" access="ROLE_USER"/&gt;
      &lt;security:intercept-url pattern="/comp/*" access="ROLE_COMP"/&gt;
      &lt;security:intercept-url pattern="/admin/*" access="ROLE_ADMIN"/&gt;
      &lt;security:intercept-url pattern="/*" access="ROLE_ANONIMOUS,ROLE_USER,ROLE_COMP,ROLE_ADMIN"/&gt;
  
      &lt;security:form-login login-page="/login"/&gt;
  &lt;/security:http&gt;
  </code></pre>