title: How to configurate Spring security 4 and JSF
body: <p>I'm trying to set up Spring security 4.1 and JSF 2 (with primefaces 6.0 but this does not seem related).
  My problem is that when I test my login.xhtml page and I introduce the wrong username and password, login.xhtml is reloaded, and this is correct, but when I enter the correct username and password it is the same.</p>
  
  <p>I can see both parameters in the post method, this data is sent correctly, but for spring security are incorrect.</p>
  
  <p>this is my configuration spring-security-config:</p>
  
  <pre><code>&lt;http auto-config='true' use-expressions="true"&gt;
      &lt;intercept-url pattern="/xhtml/frob/index.xhtml" access="hasRole('ROLE_USER')" /&gt;
      &lt;intercept-url pattern="/xhtml/frob/**" access="hasRole('ROLE_USER')" /&gt;
      &lt;form-login login-page = "/login.xhtml" username-parameter="j_username" 
                  password-parameter="j_password" 
                  login-processing-url="/j_spring_security_check"
                  authentication-failure-url="/login?login_error=1"/&gt;
      &lt;csrf disabled="true"/&gt;  
  &lt;/http&gt;
  
  &lt;authentication-manager&gt;
      &lt;authentication-provider&gt;
          &lt;user-service&gt;
              &lt;user name="user" password="user" authorities="ROLE_USER" /&gt;
              &lt;user name="user2" password="user" authorities="ROLE_USER2" /&gt;
          &lt;/user-service&gt;
      &lt;/authentication-provider&gt;
  &lt;/authentication-manager&gt;
  </code></pre>
  
  <p>And this is login.xhtml:</p>
  
  <pre><code>&lt;h:form id="login" action="/login.xhtml" method="POST"&gt;
  
     &lt;h:outputLabel for="username" value="loginUser" /&gt;
     &lt;h:inputText value="user" tabindex="1" id="username"/&gt;
     &lt;h:outputLabel value="Password" for="password" /&gt;
     &lt;h:password value="pass" size="14" tabindex="2" id="password"/&gt;
     &lt;h:commandButton outcome="#{controlBean.next}" tabindex="3" value="Send"/&gt;
  
  &lt;/h:form&gt;
  </code></pre>
  
  <p>I need some help, I'm using Spring security 4.1.</p>