Question about exception "Success URL not available via saved request"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about exception "Success URL not available via saved request"

yuwei

Hi guys,

I wrote simple web application using spring+shiro+tomcat.

When I tried to access protected resourses, it redirected me to login page, then after login successfully, it didn't redirect to original url.


Configuration is as below,

<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
        <property name="securityManager" ref="securityManager"/>
        <property name="loginUrl" value="/login.jsp"/>
        <property name="successUrl" value="/index.jsp"/>
        <property name="unauthorizedUrl" value="/dashboard/unauthorized.jsp"/>
        <property name="filterChainDefinitions">
            <value>
                /school/list/** = authc
                /user/** = authc, roles[888888]
                /role/** = authc, roles[888888]
                /permission/** = authc, roles[888888]
            </value>
        </property>
    </bean>


Code in login controller is as below,

currentUser.login(token);

WebUtils.redirectToSavedRequest(request, response, null);


Exception indicated that the savedRequest was null.

How could I fix this problem?


Thanks,

Jared, (韦煜)
Software developer
Interested in open source software, big data, Linux

Reply | Threaded
Open this post in threaded view
|

Re: Question about exception "Success URL not available via saved request"

armandoxxx
Docs say that this should work out of the box ...

have you tried debuging AuthenticatingFilter line 54 ... it's where authenticating magic happens .. so debug into onLoginSuccess method ...
and check if this WebUtils.redirectToSavedRequest() method is ever called ...

if yes .. check it for cache value .. if empty cache value .. check where who and when is calling the method to fill this cache value ...
if method is not called check what filter is called and executed ...

maybe you'll have to write your own fitler ... I know we had to because this feature is not working properly !

regards

Armando