title: Spring Security - Different Filter Entry Points based on Role
body: <p>I'm developing a webapp which allows for two types for users - User and Admin.</p>
  
  <p>There's are two parts of the site - the User side, and the Admin side. I'm using Spring Security to secure both sites and its working pretty well except I've come across a bit of a problem.</p>
  
  <p>Basically, if the user is not logged in and tries to access a page on either part of the site, they should be directed to a different login page. For example:</p>
  
  <ul>
  <li>user is not logged in and tries to access a page which only Users can see -> user is intercepted and is directed to LoginPageOne.jsp</li>
  </ul>
  
  <p>The other case would then be:</p>
  
  <ul>
  <li>user is not logged in and tries to access a page which only Admins can see -> user is intercepted and is directed to LoginPageTwo.jsp</li>
  </ul>
  
  <p>I've tried to do this a number of ways without any success. First of all I tried to create two seperate sets of intercept-urls in my applicationContext-security.xml which would use different entry-point-refs which would in turn point to different login URLs. This failed - the webapp wouldnt even start.</p>
  
  <p>Now I'm trying to extend the AuthenticationProcessingFilterEntryPoint but I don't know how to forward the user based on the resource they're trying to access. I was hoping I could find out what Roles the user needs in order to access the resource and based off that, forward them to the correct page but I'm not sure this is possible.</p>
  
  <p>I've done a fair bit of searching across the interwebs and haven't managed to find a solution for my problem so any help with this would be greatly appreciated :-)</p>
  
  <p>Thanks,
  Ger. </p>