FileDocCategorySizeDatePackage
JaasSecurityManagerService.javaAPI DocJBoss 4.2.14785Fri Jul 13 20:53:50 BST 2007org.jboss.ejb3.embedded

JaasSecurityManagerService

public class JaasSecurityManagerService extends Object
author
carlo

Fields Summary
private static final Logger
log
private static final String
SECURITY_MGR_PATH
private static Map
cache
private Hashtable
initialContextProperties
Constructors Summary
public JaasSecurityManagerService()


    
   

   
Methods Summary
private javax.naming.InitialContextgetInitialContext()

      if (initialContextProperties != null) return new InitialContext(initialContextProperties);
      else return new InitialContext();
   
private static org.jboss.security.plugins.JaasSecurityManagergetSecurityManager(java.lang.String name)

      JaasSecurityManager manager = cache.get(name);
      if (manager != null)
      {
         //log.info("cache hit");
         return manager;
      }
      synchronized (cache)
      {
         if (manager != null)
            return manager;

         manager = new JaasSecurityManager(name, new SecurityAssociationHandler());
         cache.put(name, manager);
      }
      return manager;
   
public voidsetInitialContextProperties(java.util.Hashtable initialContextProperties)

      this.initialContextProperties = initialContextProperties;
   
public voidstart()

      XMLLoginConfigImpl configuration = new XMLLoginConfigImpl();
      configuration.setConfigResource("login-config.xml");
      configuration.loadConfig();

      Configuration.setConfiguration(configuration);

      Context ctx = getInitialContext();

      String factoryName = SecurityDomainObjectFactory.class.getName();
      Reference ref = new Reference("nl.wolfc.embedded.security.plugins.JaasSecurityManager", factoryName, null);
      ctx.rebind(SECURITY_MGR_PATH, ref);