I m developing a webapp which allows for two types for users - User and Admin.
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.
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:
- 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
The other case would then be:
- 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
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.
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.
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 :-)
Thanks, Ger.