[jboss-cvs] JBossAS SVN: r88837 - in branches/Branch_5_x: security/src/etc/bin and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 13 17:55:08 EDT 2009


Author: anil.saldhana at jboss.com
Date: 2009-05-13 17:55:08 -0400 (Wed, 13 May 2009)
New Revision: 88837

Removed:
   branches/Branch_5_x/security/src/etc/bin/password/
Modified:
   branches/Branch_5_x/build/build-distr.xml
   branches/Branch_5_x/security/src/etc/deploy/security-jboss-beans.xml
   branches/Branch_5_x/security/src/main/org/jboss/security/integration/SecurityDomainObjectFactory.java
   branches/Branch_5_x/security/src/main/org/jboss/security/integration/password/PasswordMaskManagement.java
   branches/Branch_5_x/testsuite/local.properties
Log:
JBAS-6857: merge in rev 88834 from trunk

Modified: branches/Branch_5_x/build/build-distr.xml
===================================================================
--- branches/Branch_5_x/build/build-distr.xml	2009-05-13 21:42:51 UTC (rev 88836)
+++ branches/Branch_5_x/build/build-distr.xml	2009-05-13 21:55:08 UTC (rev 88837)
@@ -925,17 +925,11 @@
     </copy>
 
     <!-- Install JBoss Security Password batch scripts -->
-    <mkdir dir="${install.bin}/password"/>
     <copy todir="${install.bin}" flatten="true" overwrite="true">
        <fileset dir="${_module.output}/etc/bin">
           <include name="password_tool.*"/>
        </fileset>
     </copy>
-    <copy todir="${install.bin}/password" flatten="true" overwrite="true">
-       <fileset dir="${_module.output}/etc/bin/password">
-          <include name="*"/>
-       </fileset>
-    </copy>
   </target>
 
   <target name="_module-security-all" depends="_module-security-most">

Modified: branches/Branch_5_x/security/src/etc/deploy/security-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/security/src/etc/deploy/security-jboss-beans.xml	2009-05-13 21:42:51 UTC (rev 88836)
+++ branches/Branch_5_x/security/src/etc/deploy/security-jboss-beans.xml	2009-05-13 21:55:08 UTC (rev 88837)
@@ -10,6 +10,9 @@
    <bean name="JBossSecurityPasswordMaskManagement"
          class="org.jboss.security.integration.password.PasswordMaskManagement" >
          <property name="keyStoreLocation">password/password.keystore</property>
+         <property name="keyStoreAlias">jboss</property>
+         <property name="passwordEncryptedFileName">password/jboss_password_enc.dat</property>
+         <property name="keyStorePasswordEncryptedFileName">password/jboss_keystore_pass.dat</property>
    </bean>
 
    <!-- Support for @Password -->

Modified: branches/Branch_5_x/security/src/main/org/jboss/security/integration/SecurityDomainObjectFactory.java
===================================================================
--- branches/Branch_5_x/security/src/main/org/jboss/security/integration/SecurityDomainObjectFactory.java	2009-05-13 21:42:51 UTC (rev 88836)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/integration/SecurityDomainObjectFactory.java	2009-05-13 21:55:08 UTC (rev 88837)
@@ -51,7 +51,7 @@
  */
 public class SecurityDomainObjectFactory implements InvocationHandler, ObjectFactory
 {
-   private JNDIBasedSecurityManagement securityManagement = new JNDIBasedSecurityManagement();
+   private JNDIBasedSecurityManagement securityManagement = null;
    
    public void setSecurityManagement(JNDIBasedSecurityManagement sm)
    {
@@ -84,6 +84,11 @@
       String securityDomain = null;
       Name name = null;
       
+      //Ensure that we get a securityManagement instance from JNDI
+      if(securityManagement == null)
+      {
+         securityManagement = (JNDIBasedSecurityManagement) ctx.lookup("java:/securityManagement");
+      }
       
       String methodName = method.getName();
       if( methodName.equals("toString") == true )

Modified: branches/Branch_5_x/security/src/main/org/jboss/security/integration/password/PasswordMaskManagement.java
===================================================================
--- branches/Branch_5_x/security/src/main/org/jboss/security/integration/password/PasswordMaskManagement.java	2009-05-13 21:42:51 UTC (rev 88836)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/integration/password/PasswordMaskManagement.java	2009-05-13 21:55:08 UTC (rev 88837)
@@ -92,6 +92,7 @@
       load();
    }  
    
+   //Public property setters
    public void setKeyStoreLocation(String location)
    {
       if(location == null)
@@ -273,25 +274,48 @@
       {
          if(keystoreLocation == null)
             throw new IllegalStateException("KeyStore Location is null");
+
+         ClassLoader tcl = SecurityActions.getContextClassLoader();
+         
+         /**
+          * Look for the encrypted keystore pass file
+          * via the direct File approach or via the context classloader
+          */
+         URL keyEncFileURL = null;
+         File keyfile = new File(keystorePassEncFileName);
+         if(keyfile.exists() == false)
+         {
+            keyEncFileURL = tcl.getResource(keystorePassEncFileName);
+         }
+         else
+            keyEncFileURL = keyfile.toURL();
+         
          //Get the keystore passwd
          FilePassword fp = null;
          try
          { 
-            fp = new FilePassword(keystorePassEncFileName);
-            this.storePass = fp.toCharArray();            
-         }
+            fp = new FilePassword(keyEncFileURL.toString());  
+            this.storePass = fp.toCharArray();
+         } 
          catch(IOException eof)
          {
-            //Try the TCL
-            ClassLoader tcl = SecurityActions.getContextClassLoader();
-            URL resLocation = tcl.getResource(keystorePassEncFileName);
-            fp = new FilePassword(resLocation.toExternalForm());
-            this.storePass = fp.toCharArray(); 
+            throw new IllegalStateException("The Keystore Encrypted file not located:",eof); 
          }
          
          if(this.storePass == null)
             throw new IllegalStateException("Keystore password is null");
-         this.keystore = KeyStoreUtil.getKeyStore(keystoreLocation, storePass); 
+         
+         /**
+          * We look for the keystore in either direct File access or
+          * via the context class loader
+          */
+         URL ksFileURL = null;
+         File ksFile = new File(keystoreLocation);
+         if(ksFile.exists() == false)
+            ksFileURL = tcl.getResource(keystoreLocation);
+         else
+            ksFileURL = ksFile.toURL();
+         this.keystore = KeyStoreUtil.getKeyStore(ksFileURL, storePass); 
       }
    }
    

Modified: branches/Branch_5_x/testsuite/local.properties
===================================================================
--- branches/Branch_5_x/testsuite/local.properties	2009-05-13 21:42:51 UTC (rev 88836)
+++ branches/Branch_5_x/testsuite/local.properties	2009-05-13 21:55:08 UTC (rev 88837)
@@ -50,6 +50,7 @@
 # ips and the rest are optional. 
 #
 #node0=${env.MYTESTIP_1}
+#node0=192.168.15.101
 #node0.http.url=http://192.168.1.103:8080
 #node0.jndiurl=jnp://192.168.1.103:1099
 #node0.hajndi.url=jnp://192.168.1.103:1100




More information about the jboss-cvs-commits mailing list