[jboss-cvs] JBossAS SVN: r72539 - in trunk: server/src/etc/deploy and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 22 00:36:14 EDT 2008


Author: anil.saldhana at jboss.com
Date: 2008-04-22 00:36:14 -0400 (Tue, 22 Apr 2008)
New Revision: 72539

Added:
   trunk/security/src/main/org/jboss/security/integration/JNDIBasedSecurityPolicyRegistration.java
Modified:
   trunk/server/src/etc/deploy/security-beans.xml
Log:
JBAS-5469: policy registration bean in JNDI

Added: trunk/security/src/main/org/jboss/security/integration/JNDIBasedSecurityPolicyRegistration.java
===================================================================
--- trunk/security/src/main/org/jboss/security/integration/JNDIBasedSecurityPolicyRegistration.java	                        (rev 0)
+++ trunk/security/src/main/org/jboss/security/integration/JNDIBasedSecurityPolicyRegistration.java	2008-04-22 04:36:14 UTC (rev 72539)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.security.integration;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.jboss.security.authorization.PolicyRegistration;
+
+/**
+ *  Establishes a PolicyRegistration Instance
+ *  under a particular JNDI context
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Apr 17, 2008 
+ *  @version $Revision$
+ */
+public class JNDIBasedSecurityPolicyRegistration
+{
+   private String contextName = "java:/policyRegistration";
+    
+   private PolicyRegistration policyRegistration = null; 
+   
+   public PolicyRegistration getPolicyRegistration()
+   {
+      return policyRegistration;
+   }
+
+   public void setPolicyRegistration(PolicyRegistration policyRegistration)
+   {
+      if(policyRegistration == null)
+         throw new IllegalArgumentException("null policyRegistration");
+      this.policyRegistration = policyRegistration;
+      try
+      {
+         initialize();
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   private void initialize() throws Exception
+   {
+      Context ctx = new InitialContext();
+      ctx.rebind(this.contextName, this.policyRegistration);
+   }
+}
\ No newline at end of file

Modified: trunk/server/src/etc/deploy/security-beans.xml
===================================================================
--- trunk/server/src/etc/deploy/security-beans.xml	2008-04-22 04:34:35 UTC (rev 72538)
+++ trunk/server/src/etc/deploy/security-beans.xml	2008-04-22 04:36:14 UTC (rev 72539)
@@ -14,6 +14,18 @@
    <!-- JNDI Based Security Management -->
    <bean name="JNDIBasedSecurityManagement" class="org.jboss.security.integration.JNDIBasedSecurityManagement"/>
 
+   <!-- Instance of Policy Registration -->
+   <bean name="JBossSecurityPolicyRegistration"
+         class="org.jboss.security.plugins.JBossPolicyRegistration" />
+
+   <!-- Bind the PolicyRegistration to JNDI under java:/policyRegistration -->
+   <bean name="JNDIBasedSecurityPolicyRegistration" 
+         class="org.jboss.security.integration.JNDIBasedSecurityPolicyRegistration">
+      <property name="policyRegistration"><inject bean="JBossSecurityPolicyRegistration" /></property>
+   </bean>
+     
+
+   <!--  Establish the basic XML Based Configuration-->
    <bean name="XMLLoginConfig" class="org.jboss.security.auth.login.XMLLoginConfig">
       <property name="configResource">login-config.xml</property>
    </bean>




More information about the jboss-cvs-commits mailing list