Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Short answer (which is a guess): The problem could be that your pre-auth filter (or other non-form login filter) creates a session without itself invoking the <code>SessionAuthenticationStrategy</code> first.</p> <p>Long explanation: The <a href="https://github.com/SpringSource/spring-security/blob/master/web/src/main/java/org/springframework/security/web/session/SessionManagementFilter.java#L70" rel="nofollow">line you mentioned</a> is basically checking whether the request has just been authenticated in the current execution of the filter chain without the auth-filter creating a new session. The check inspects if there is a session, and if an auth object has already been saved to the session. </p> <p>If it finds the session and the saved auth object, that means nothing has to be done: everything has already been arranged regarding authentication and session management either by some other filter, or by the same <code>SessionManagementFilter</code> during processing a previous request earlier in the same session.</p> <p>The other case is when no session has been created or the (non-anonymous) auth object has not yet been saved in the existing session. Only in this case is it the <code>SessionManagementFilter</code>'s responsibility to actully perform session management by invoking the <code>SessionAuthenticationStrategy</code>.</p> <p>According to your description, this second case never occurs, which means that the session is already created, and the auth object is already saved at this point of execution. That should mean your custom auth filter must have created a session, which is not a problem in itself. The general rule however is that anyone creating a session must first consult the <code>SessionAuthenticationStrategy</code> itself. If your auth filter chooses to ignore it, nothing can be done by the <code>SessionManagementFilter</code> (it cannot undone the session creation, even if the <code>SessionAuthenticationStrategy</code> had raised a veto against the user's authenticatation).</p> <p>Doublecheck if this is the case, and try avoid creating a session in your pre-auth filter. Note that session creation can also happen in a sneaky way by <a href="https://github.com/SpringSource/spring-security/blob/master/web/src/main/java/org/springframework/security/web/context/HttpSessionSecurityContextRepository.java#L293" rel="nofollow"><code>SaveToSessionResponseWrapper.saveContext()</code></a> getting called e.g. upon a redirect.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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