[jboss-cvs] JBossAS SVN: r88834 - in trunk: security/src/etc/bin and 2 other directories.

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


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

Removed:
   trunk/security/src/etc/bin/password/
Modified:
   trunk/build/build-distr.xml
   trunk/security/src/etc/deploy/security-jboss-beans.xml
   trunk/security/src/main/org/jboss/security/integration/password/PasswordMaskManagement.java
Log:
JBAS-6710: remove the password keystore in the bin directory

Modified: trunk/build/build-distr.xml
===================================================================
--- trunk/build/build-distr.xml	2009-05-13 21:19:50 UTC (rev 88833)
+++ trunk/build/build-distr.xml	2009-05-13 21:31:55 UTC (rev 88834)
@@ -611,17 +611,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: trunk/security/src/etc/deploy/security-jboss-beans.xml
===================================================================
--- trunk/security/src/etc/deploy/security-jboss-beans.xml	2009-05-13 21:19:50 UTC (rev 88833)
+++ trunk/security/src/etc/deploy/security-jboss-beans.xml	2009-05-13 21:31:55 UTC (rev 88834)
@@ -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: trunk/security/src/main/org/jboss/security/integration/password/PasswordMaskManagement.java
===================================================================
--- trunk/security/src/main/org/jboss/security/integration/password/PasswordMaskManagement.java	2009-05-13 21:19:50 UTC (rev 88833)
+++ trunk/security/src/main/org/jboss/security/integration/password/PasswordMaskManagement.java	2009-05-13 21:31:55 UTC (rev 88834)
@@ -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); 
       }
    }
    




More information about the jboss-cvs-commits mailing list