1 Reply Latest reply on Jul 28, 2014 3:44 AM by pmm

    DatabaseServerLoginModule caching the user ???

    suikast42

      Hi guys,

       

      I'm using the DatabaseServerLoginModule form pixedbox wich shipped with wildfly 8.1.0.Final for JSF and remote EJB authentification. If I activate the logging for org.jboss.security I see that the loginmodule do a lot of queries for every request( regardless if I do a login with JSF or jboss remooting)  on the database.

       

      Is there a capability of  the login module for query or user caching? If yes how can I invalidate the caching if something cahnged with the roles?

       

      Thanks in advance.

        • 1. Re: DatabaseServerLoginModule caching the user ???
          pmm

          It works for us we use

          <security-domain name="jboss-ejb-policy" cache-type="default">
          

           

           

          We clear the cache using JMX. The can flush the whole cache if you remove the username argument.

           

          private void flushPrincipalFromAuthenticationCache() {
          
            String objectName = "jboss.as:subsystem=security,security-domain=" + SECURITY_DOMAIN;
            Object[] params = {getUsername()};
            String[] signature = {String.class.getName()};
            try {
            MBeanServerConnection mbeanServerConnection = ManagementFactory.getPlatformMBeanServer();
            ObjectName mbeanName = new ObjectName(objectName);
            mbeanServerConnection.invoke(mbeanName, SECURITY_MANAGER_FLUSH_AUTHENTICATION_CACHE, params, signature);
            } catch (JMException e) {
            log.warn("Could not find JASS security manager MBean: " + objectName, e);
            } catch (IOException e) {
            log.warn("Caught exception from invocation of JASS security manager MBean: " + objectName
            + ", operation: " + SECURITY_MANAGER_FLUSH_AUTHENTICATION_CACHE, e);
            }
            }
          
          1 of 1 people found this helpful