title: Integrating spring security with Ajax calls
body: <p>So I have a web app that utilises jsf and primefaces for it's front end presentation.</p>
  
  <p>We are using Spring security for the login mechanism and have defined the concurrency as such</p>
  
  <pre><code>&lt;session-management session-fixation-protection="newSession"&gt;
  &lt;concurrency-control max-sessions="1" error-if-maximum-exceeded="true" 
  expired-url="multipleLogins.xhtml" /&gt;
  &lt;/session-management&gt;
  </code></pre>
  
  <p>The problem seems to be when  a user has two logins from different browsers there are certain buttonas that perform ajax actions that do not trigger the redirect. It seems to only be buttons that submit forms or redirect to pages themselves that will recognise the multiple logins actions.</p>
  
  <p>For example, this button</p>
  
  <pre><code>&lt;p:commandButton id="retrieve" value="#{msgs.BUTTON_RETRIEVE}"
  action="#{removeContactForm.retrieve}" update="@form"/&gt;
  </code></pre>
  
  <p>Which retrieves things from a web service and displays them on a page will not trigger the redirect if there are multiple logins.</p>
  
  <pre><code>&lt;p:commandButton id="remove" value="#{msgs.BUTTON_REMOVE}"
  action="/pages/confirm/confirmRemove.xhtml" ajax="false" process="@this"          
  immediate="true" rendered="#{!empty removeContactManager and   
  removeContactManager.contactRolesSuccessful}" /&gt;
  </code></pre>
  
  <p>This button will however (as it redirects to another page)</p>
  
  <p>Anyone know a way of making the webapp register those ajax calls as events, without sticking everything ajax based into a new page?</p>