Quantcast

How to prevent redirect (302) to after Ajax login with Spring Security plugin version 1.0.1

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How to prevent redirect (302) to after Ajax login with Spring Security plugin version 1.0.1

Alex De Marco
From hostA I am sending a simple Form POST with user's login
credentials to http://hostB/j_spring_security_check?ajax=true . I am
not using XHR, just a form post that is urlencoded.

When login succeeds or fails on the hostB side, I want to render the
standard ajax success or error messages as JSON without a redirect
because the redirect is disallowed on hostA due to the browser's same
origin policy restrictions.

How do I prevent the redirect and render or send an error instead?

Do I need to write a custom filter or is there a config setting to
prevent redirects?

I just want to send back basic JSON success/error messages or HTTP
errors like response.sendError HttpServletResponse.SC_UNAUTHORIZED

I googled and found apf.serverSideRedirect but it does not seem to
work anymore in the latest version of Spring Security 3. I've tried
setting it in Config.groovy, and there's no effect.

grails.plugins.springsecurity.apf.serverSideRedirect=true // true and
false... neither seems to do anything :-(

/alex

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to prevent redirect (302) to after Ajax login with Spring Security plugin version 1.0.1

Leolion75
Did you ever find a solution or workaround? I have the same issue, I do not want a redirect to occur from an AJAX-based request.

-Leo
Loading...