My grails web app has two parts: one for desktop / laptop browsers, one for mobile devices which uses jquery-mobile. The mobile part lives in a subtree /mobile/*. Using spring security I’d like to have different controllers/views for login, logout, etc. I haven’t found any useful hints researching this topic on the web.
The only option I can currently think of is to extract the mobile app into a grails project of its own which will then force me to extract common logic into a grails plugin which will then force me to a completely different dev and deployment set up and so on… I’d much rather keep mobile and non-mobile part in the same app but cannot figure out how.
Any suggestions appreciated…
Try this one again…
I have been working on something similar lately as well. And had the same ‘wants’ as you. Here is what I ended up with.
To point to different login screens I overwrote the AuthenticationEntryPoint step of the security filter chain (spring security). I used the same logic that the spring-mobile plugin uses. (In fact, you will have to have spring-mobile plugin installed for this to work) The deviceResolver is wired up by that plugin.
Wired like so in resources.groovy
Config lines in Config.groovy
I have also written my AuthenticationSuccessHandler step to force mobile users to the mobile landing page after login.
This doesn’t stop the user from browsing to a non-mobile page, but it does force them to the /mobile/index after login. Form there all my links on my mobile pages refer to other mobile pages.