3

My web applications is secured with Spring-security and now I'm trying to setup two different login pages. Here is my configuration:

<http use-expressions="true" pattern="/mobile/**">
    <intercept-url pattern="/**" access="hasAnyRole('ROLE_ONE','ROLE_TWO')" requires-channel="http"/>

    <form-login login-page="/loginm" login-processing-url="/loginm_check" default-target-url="/mobile/menu" authentication-failure-url="/loginmfailed"  />
    <logout logout-url="/logoutm" logout-success-url="/loginm" />
</http>

<http use-expressions="true">
    <intercept-url pattern="/main.html" access="isAuthenticated()" requires-channel="http" />

    <form-login login-page="/login" login-processing-url="/login_check" default-target-url="/main.html" authentication-failure-url="/loginfailed"/>
    <logout logout-url="/logout" logout-success-url="/login" />
</http>

The second form works well. But the first form doesn't seem to work at all. The server returns 404 for the login-processing-url="/loginm_check".

I'm using the latest Spring-Security 3.1.4.RELEASE.

Can anyone help with this?

Thanks

user1703531
  • 81
  • 3
  • 7
  • It doesn't make any sense if both use the same authentication. If you wan't a different page layout for mobile devices you should be solving it with view resolvers. – Bart Sep 15 '13 at 17:56
  • 1
    Your login for mobile should be under the /mobile URL. Currently it matches the default http element which doesn't recognize the URL. Next to that why should you have different configurations? As @bart already mentioned you can have a Spring `ViewResolver` handle that for you. – M. Deinum Sep 16 '13 at 06:19
  • Well I thought that's the idea of Spring Security - to handle things instead of me writing from scratch. I already made it with view resolvers but for me the cleaner way to do is to use Spring's configuration. Anyway thanks for the hint with the URL, I' try that. – user1703531 Sep 16 '13 at 10:10
  • I tried changing login-processing-url to "/mobile/loginm_check" and I still get this 404 error – user1703531 Sep 16 '13 at 14:47
  • EDIT: changing the URL actually worked. Thanks! – user1703531 Sep 16 '13 at 16:07

0 Answers0