Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To force spring-security to go to <code>/pages/index.xhtml</code>, you can use property <code>always-use-default-target</code> as this : </p> <pre><code>&lt;form-login login-page='/pages/login.xhtml' default-target-url="/pages/index.xhtml" always-use-default-target="true" authentication-failure-url="/pages/login.xhtml"/&gt; </code></pre> <p>Otherwise, the login page should be shown automatically by spring security when the user calls a secured resource, and once login done, continue to the secured resource it was originally asked for.</p> <p>In your case, some confusion seems to come from the fact that you want spring security to handle the login, and you try to handle it yourself with a jsf actionListener and navigation rules.</p> <p>putting "<code>&lt;form-login [...]</code>" in the configuration essentially tells spring to activate a filter (<code>UsernamePasswordAuthenticationFilter</code>) that will listen to requests made to <code>/j_spring_security_check</code> . If you want spring to handle login, by default your form login must request this url, passing two parameters : <code>j_username</code> and <code>j_password</code> .</p> <p>This way, spring's <code>UsernamePasswordAuthenticationFilter</code> will kick in and try to authenticate the provided credentials using the UserDetailsService you configured in your AuthenticationProvider.</p> <p>I think you have to remove your jsf controller for login and use spring-security to handle authentication.</p> <p>Hope this helps.</p> <p>PS : make sure your web.xml defines the DelegatingFilterProxy before all other servlet filters :</p> <pre><code>&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; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload