I have two login pages, one for user and other for admin. In order to know who is trying to login, I think of having a url pattern like /app/admin/login
and /app/user/login
. I cannot change by subdomain. This is a grails application which uses spring security. So by default all the login requests are sent to /j_spring_security_check
url. What should I do in order to change the login submission url from /j_spring_security_check
to /app/$context/login
where $context can be user or admin?
Another problem I face is, how to get the request params my custom UserDetailsServices class? The params
is not available in that class, so I cannot write params.context
like we do in Filters class.
Any insight into this would be highly helpful.
Thanks.
This post might help with the j_spring_security question. The solution is not for Grails directly, but I have seen that Grails allows you to customize Spring any way you like.
For the service layer question regarding params: params is an implicit HttpRequest.parameters object for Controller. One should never try to expect any Http awareness in the service layer.
So its a good thing we can't reference it in the service layer. My advice would be to pass it as an argument to the service class method.