[gatein-commits] gatein SVN: r2502 - components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/login.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Apr 6 14:46:53 EDT 2010


Author: sohil.shah at jboss.com
Date: 2010-04-06 14:46:53 -0400 (Tue, 06 Apr 2010)
New Revision: 2502

Modified:
   components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/login/SPNEGORolesModule.java
Log:
spnego ready to roll

Modified: components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/login/SPNEGORolesModule.java
===================================================================
--- components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/login/SPNEGORolesModule.java	2010-04-06 18:34:53 UTC (rev 2501)
+++ components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/login/SPNEGORolesModule.java	2010-04-06 18:46:53 UTC (rev 2502)
@@ -24,14 +24,8 @@
 
 import java.security.Principal;
 import java.security.acl.Group;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
 import javax.security.auth.Subject;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginException;
@@ -46,8 +40,6 @@
 import org.exoplatform.services.security.Identity;
 import org.exoplatform.services.security.Authenticator;
 import org.exoplatform.services.security.IdentityRegistry;
-import org.exoplatform.container.monitor.jvm.J2EEServerInfo;
-import org.exoplatform.services.security.jaas.UserPrincipal;
 
 /**
  * The LoginModule that is responsible for setting up the proper GateIn roles
@@ -200,96 +192,4 @@
 			throw new LoginException(e.getMessage());
 		}
 	}
-
-	@Override
-	public boolean logout() throws LoginException
-	{
-		org.exoplatform.container.monitor.jvm.J2EEServerInfo info = new J2EEServerInfo();
-		MBeanServer jbossServer = info.getMBeanServer();
-
-		//
-		if (jbossServer != null)
-		{
-			try
-			{
-
-				log.debug("Performing JBoss security manager cache eviction");
-
-				ObjectName securityManagerName = new ObjectName(
-						"jboss.security:service=JaasSecurityManager");
-
-				// Obtain user name
-				String userName = null;
-				Set<UserPrincipal> userPrincipals = subject
-						.getPrincipals(UserPrincipal.class);
-				if (!userPrincipals.isEmpty())
-				{
-					// There should be one
-					userName = userPrincipals.iterator().next().getName();
-				}
-
-				//
-				if (userName != null)
-				{
-					log
-							.debug("Going to perform JBoss security manager cache eviction for user "
-									+ userName);
-
-					//
-					List allPrincipals = (List) jbossServer.invoke(securityManagerName,
-							"getAuthenticationCachePrincipals", new Object[] { realmName },
-							new String[] { String.class.getName() });
-
-					// Make a copy to avoid some concurrent mods
-					allPrincipals = new ArrayList(allPrincipals);
-
-					// Lookup for invalidation key, it must be the same principal!
-					Principal key = null;
-					for (Iterator i = allPrincipals.iterator(); i.hasNext();)
-					{
-						Principal principal = (Principal) i.next();
-						if (principal.getName().equals(userName))
-						{
-							key = principal;
-							break;
-						}
-					}
-
-					// Perform invalidation
-					if (key != null)
-					{
-						jbossServer.invoke(securityManagerName, "flushAuthenticationCache",
-								new Object[] { realmName, key }, new String[] {
-										String.class.getName(), Principal.class.getName() });
-						log
-								.debug("Performed JBoss security manager cache eviction for user "
-										+ userName + " with principal " + key);
-					}
-					else
-					{
-						log
-								.warn("No principal found when performing JBoss security manager cache eviction for user "
-										+ userName);
-					}
-				}
-				else
-				{
-					log
-							.warn("No user name found when performing JBoss security manager cache eviction");
-				}
-			}
-			catch (Exception e)
-			{
-				log.error("Could not perform JBoss security manager cache eviction", e);
-			}
-		}
-		else
-		{
-			log
-					.debug("Could not find mbean server for performing JBoss security manager cache eviction");
-		}
-
-		//
-		return true;
-	}
 }



More information about the gatein-commits mailing list