Results 1 to 6 of 6

Thread: how to clear user cache after user changes password

  1. #1
    Join Date
    Sep 2004
    Location
    Singapore
    Posts
    29

    Default how to clear user cache after user changes password

    Hi,
    Would appreciate if anyone could provide HOW-To of clearing user cache,

    the problem is that the user can still login after he changes password, even he log out, and session is invalidated.

    I think this is because the user cache is not cleared when password is changed. So the result is that the user can login using the old and new password ! (of cause after using the new password, the old one is automatically invalidated).

    thanks
    lixin
    lixin

  2. #2
    Join Date
    Sep 2004
    Location
    Singapore
    Posts
    29

    Default

    I am using:

    <bean id="userCache" class="net.sf.acegisecurity.providers.dao.cache.Eh CacheBasedUserCache">
    <property name="cache">
    <bean class="org.springframework.cache.ehcache.EhCacheFa ctoryBean">
    <property name="cacheManager">
    <bean class="org.springframework.cache.ehcache.EhCacheMa nagerFactoryBean"/>
    </property>
    <property name="cacheName"><value>userCache</value></property>
    </bean>
    </property>
    </bean>
    lixin

  3. #3
    Join Date
    Oct 2004
    Posts
    207

    Default

    One option would be to pass the userCache to your form controller that handles the pasword change and call the removeUserFromCache(username) method.

    Another option would be to handle it with events. Have your controller fire some kind of PasswordChangedEvent or something that carries the username. Then create an ApplicationContextListener that has a setter for the userCache, and handle the event by calling userCache.removeUserFromCache(username).

    Hope that helps.

  4. #4
    Join Date
    Sep 2004
    Location
    Singapore
    Posts
    29

    Default

    thanks !

    I like the second idea, that's something new to me, have not done this before - actually i did not know i can do so in this way.

    thanks for your help !
    lixin

  5. #5
    Join Date
    Oct 2004
    Posts
    207

    Default

    Hope that helps, and it's ApplicationListener, not ApplicationContextListener, sorry.

  6. #6
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Last edited by robyn; May 16th, 2006 at 03:44 AM.

Similar Threads

  1. Problem with HibernateInterceptor
    By prane in forum Data
    Replies: 5
    Last Post: Oct 16th, 2007, 08:01 AM
  2. LDAPPasswordAuthenticationDao problem
    By benoit_m35 in forum Security
    Replies: 15
    Last Post: Jan 11th, 2006, 07:04 AM
  3. Forgot password (e.g. secret question) using Acegi
    By lowerymb77 in forum Security
    Replies: 1
    Last Post: Oct 16th, 2005, 10:46 PM
  4. Replies: 3
    Last Post: Sep 22nd, 2005, 10:14 AM
  5. Redeploy problem with User Cache
    By orhanu in forum Security
    Replies: 3
    Last Post: Mar 10th, 2005, 04:25 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
  •