Hi Marcus,

Use the following from within your Spring MVC controller:

import org.apache.shiro.web.util.WebUtils;
...
String fallbackUrl = "/path/to/go/to/incase/there/is/no/saved/request";
WebUtils.redirectToSavedRequest(request, response, fallbackUrl);
return null; //tell Spring MVC not to render a view, we're redirecting
explicitly

HTH,

--
Les Hazlewood
CTO, Stormpath | http://www.stormpath.com | 888.391.5282
twitter: @lhazlewood | http://twitter.com/lhazlewood
blog: http://leshazlewood.com
stormpath blog: http://www.stormpath.com/blog/

On Wed, Apr 11, 2012 at 3:29 AM, Marcus Bond <[email protected]> wrote:
> Hi,
>
>
>
> I have a Spring MVC web application configured such that in web.xml my
> shiroFilter is a org.springframework.web.filter.DelegatingFilterProxy and
> the shiroFilter bean is org.apache.shiro.spring.web.ShiroFilterFactoryBean.
> I use a shiro filter called authc which is a
> org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter configured
> via the factory bean to have loginUrl of  /login which is a Spring
> Controller.
>
>
>
> What this means in English is that I have configured Shiro to delegate login
> to a Spring Controller and all is working fine. However, I now need to add
> the capability to remember a requested URL and redirect to that if the user
> first had to authenticate. Shiro already supports this and the
> PassThruAuthenticationFilter saves the request but what I want to know is
> how I can make use of the Shiro functionality to easily redirect the user to
> their originally requested URL upon a successful login from within the code
> of my controller.
>
>
>
> Cheers,
>
> Marcus.
>
>

Reply via email to