[jboss-cvs] JBossAS SVN: r57522 - branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/security

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 9 22:32:29 EDT 2006


Author: anil.saldhana at jboss.com
Date: 2006-10-09 22:32:28 -0400 (Mon, 09 Oct 2006)
New Revision: 57522

Added:
   branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/security/SecurityDomainManager.java
Log:
EJBTHREE-732: Consolidate security mgr lookup

Added: branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/security/SecurityDomainManager.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/security/SecurityDomainManager.java	2006-10-10 02:03:56 UTC (rev 57521)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/security/SecurityDomainManager.java	2006-10-10 02:32:28 UTC (rev 57522)
@@ -0,0 +1,56 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.ejb3.security;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+//$Id$
+
+/**
+ *  Utility class that deals with the authentication/authorization
+ *  managers associated with a security domain
+ *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ *  @since  Oct 9, 2006 
+ *  @version $Revision$
+ */
+public class SecurityDomainManager
+{
+   public static Object getSecurityManager(String securityDomain,
+         InitialContext ctx) throws NamingException
+   { 
+      return ctx.lookup(preProcessSecurityDomain(securityDomain)); 
+   }
+   
+   /**
+    * Ensure that the security domain is of the proper format
+    * @param domainValue
+    * @return
+    */
+   private static String preProcessSecurityDomain(String domainValue)
+   { 
+      if(domainValue.startsWith("java:/jaas"))
+         return domainValue;
+      else
+         return "java:/jaas/" + domainValue;
+   }
+}




More information about the jboss-cvs-commits mailing list