1 Reply Latest reply on Apr 4, 2002 9:34 AM by dirk.haase

    Database login module and caching

    pkghosh

      I am using Database login module provided by JBOSS. However, I am having a problem with the server caching the user credentials. I have a user management web page through which accounts can be deleted. Here is the scenario. User A logs in and then logs out. User B removes user A from the database. At this point user A can login again because of caching.

      I have a login method in an ejb which gets called to authenticate users when they login through a web form. I was hoping that there will be a way to flush the server cache. Otherwise, I have to query the database from my login method.

      Pranab

        • 1. Re: Database login module and caching
          dirk.haase

          Hi,

          I have the same problem. Following code should flush the authentication cache. It compiles and runs for me, but the flush wasnt really successfull. I am still hoping to find out how to do this. Maybe someone else can help us out.

          String securityDomain = "default"; // this might be wrong.
          MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
          ObjectName jaasMgr = new ObjectName("Security:name=JaasSecurityManager");
          Object[] params = {securityDomain};
          String[] signature = {"java.lang.String"};
          server.invoke(jaasMgr,"flushAuthenticationCache",params,signature);

          Can anyone help on this?

          thanks,
          Jex

          btw: If you wait longer than 30mins after deleting the account, the cache is flushed automatically. That works in my tests.