[jboss-user] [Security & JAAS/JBoss] - Help! flushAuthenticationCache cann't work!

joeyli do-not-reply at jboss.com
Fri Dec 15 03:29:14 EST 2006


I use the following code to flush the role, but I use the request.isUserInRole('Anonymous'), the result is still true:

  |     private void logout() throws Exception {
  | 
  |         String domainName = "EatOutDomain";
  | 
  |         MBeanServer server = (MBeanServer) MBeanServerFactory
  |                 .findMBeanServer(null).get(0);
  |         String jaasMgrName= "jboss.security:service=JaasSecurityManager";
  |         ObjectName jaasMgr = new ObjectName(jaasMgrName);
  |         Object[] params = { domainName };
  |         String[] signature = { "java.lang.String" };
  |         List users = (List) server.invoke(jaasMgr,
  |                 "getAuthenticationCachePrincipals", params, signature);
  | 
  |         for (int i = 0; i < users.size(); i++) {
  |             SimplePrincipal principal = (SimplePrincipal) users.get(i);
  | 
  |             
  |           Object[] pParams = { domainName, principal };
  |           String[] pSignature = { "java.lang.String", "java.security.Principal"};
  |           server.invoke(jaasMgr, "flushAuthenticationCache", pParams,
  |                   pSignature);            
  |           
There have only one principal "Anonymous" in domain, and I user getAuthenticationCachePrincipals to get the roles after call "flushAuthenticationCache", the prinipals all clearned.
But, I use the request.isUserInRole("Anonymous") the result is always is true.
How can I clean the request.isUserInRole()? And relogin into web site?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994143#3994143

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994143



More information about the jboss-user mailing list