Results 1 to 5 of 5

Thread: How to remember last visited page?

  1. #1
    Join Date
    Jan 2011
    Posts
    27

    Default How to remember last visited page?

    How to after login enter the page which was visited last before logout?

    Here is security config:

    Code:
      <security:http auto-config="true">
            <security:intercept-url pattern="/login.action" filters="none"/>
            <security:intercept-url pattern="/res/**" filters="none"/>
            <security:intercept-url pattern="/admin/**" access="ROLE_ADMIN"/>
            <security:intercept-url pattern="/**" access="ROLE_USER"/>
            <security:access-denied-handler error-page="/denied.action"/>
    
            <security:form-login login-page='/login.action'
                                 authentication-failure-url="/login.action?login_error=1"
                                 default-target-url='/dashboard.action'/>
        </security:http>
    
    
        <security:authentication-manager>
            <security:authentication-provider ref="portalAuthenticationProvider"/>
        </security:authentication-manager>
    
        <bean id="portalAuthenticationProvider" class="com.colvir.portal.security.PortalAuthenticationProvider">
            <property name="userService" ref="userService"/>
        </bean>
    
          <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"
                    p:targetClass="org.springframework.security.core.context.SecurityContextHolder"
                    p:targetMethod="setStrategyName" p:arguments="MODE_INHERITABLETHREADLOCAL"/>
    Now I always hit dashboard.action after login.
    (As you can see always-use-default-target isn't set.)

  2. #2
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    If you logout and invalidate the session, you will lose all information.

    So you'd need to record the current page information for each user if you want them to be able to return there after a later login.
    Spring - by Pivotal
    twitter @tekul

  3. #3
    Join Date
    Jan 2011
    Posts
    27

    Default

    For logout I use link to /j_spring_security_logout.

    So you'd need to record the current page information for each user if you want them to be able to return there after a later login.
    Is there any samples how to do that?

  4. #4
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    Quote Originally Posted by kostepanych View Post
    Is there any samples how to do that?
    Not that I know of. You could potentially use a cookie or store the information in a database when the user logs out, retrieving it when they log back in.
    Spring - by Pivotal
    twitter @tekul

  5. #5
    Join Date
    Jan 2011
    Posts
    27

    Default

    What method and in which class should I override to direct user into correct page after login?
    Last edited by kostepanych; Feb 24th, 2011 at 07:53 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •