Wildfly caches roles after logout in a web application

前端 未结 1 657
刺人心
刺人心 2021-01-01 00:23

jboss-web.xml



my-aktion
         


        
1条回答
  •  伪装坚强ぢ
    2021-01-01 01:13

    This is a bug in wildfly 8.0.0 planned to be fixed in 8.1. see https://issues.jboss.org/browse/WFLY-3221

    In the meantime you can try this workaround to clear cache for a specific user when the session times out or it's invalidated.

    Create a Session listener and call the method from sessionDestroyed.

    public void clearCache(String username){
    try {
    
        ObjectName jaasMgr = new ObjectName("jboss.as:subsystem=security,security-domain=" );
        Object[] params = {username};
        String[] signature = {"java.lang.String"};
        MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
        server.invoke(jaasMgr, "flushCache", params, signature);
    } catch (Exception ex) {
        logger.warn(ex.getMessage());
    }}
    

    0 讨论(0)
提交回复
热议问题