[jboss-cvs] JBossAS SVN: r88676 - branches/Branch_5_x/security/src/main/org/jboss/security/integration/password.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 11 17:42:56 EDT 2009


Author: anil.saldhana at jboss.com
Date: 2009-05-11 17:42:56 -0400 (Mon, 11 May 2009)
New Revision: 88676

Modified:
   branches/Branch_5_x/security/src/main/org/jboss/security/integration/password/PasswordTool.java
Log:
JBAS-6857: load the password file

Modified: branches/Branch_5_x/security/src/main/org/jboss/security/integration/password/PasswordTool.java
===================================================================
--- branches/Branch_5_x/security/src/main/org/jboss/security/integration/password/PasswordTool.java	2009-05-11 21:38:26 UTC (rev 88675)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/integration/password/PasswordTool.java	2009-05-11 21:42:56 UTC (rev 88676)
@@ -22,6 +22,7 @@
 package org.jboss.security.integration.password;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.util.Scanner;
 
 import org.jboss.security.plugins.FilePassword;
@@ -73,6 +74,7 @@
          System.out.println(commandStr);
          Scanner in = new Scanner(System.in);
          int choice = in.nextInt();
+         
          switch(choice)
          {
             case 0: //Encrypt Keystore Password
@@ -113,6 +115,7 @@
                String loc = in.next();
                System.out.println("Enter Keystore alias");
                String alias = in.next();
+               
                try
                {
                   pwm.setKeyStoreDetails(loc, alias); 
@@ -122,8 +125,9 @@
                   System.out.println("Exception being raised. Try to first encrypt the keystore password.");
                   System.out.println("or check the keystore location."); 
                } 
+               load();
                break;
-            case 2:  
+            case 2:  //Create a password 
                if(pwm.keyStoreExists())
                {
                   System.out.println("Enter security domain:");
@@ -131,11 +135,12 @@
                   System.out.println("Enter passwd:");
                   String p = in.next();
                   pwm.storePassword(domain, p.toCharArray()); 
+                  System.out.println("Password created for domain:" + domain); 
                }
                else
                   System.out.println("Enter Keystore details first");
                break;
-            case 3:
+            case 3: //Remove a domain
                if(pwm.keyStoreExists())
                {
                   System.out.println("Enter security domain to be removed:");
@@ -145,7 +150,7 @@
                else
                   System.out.println("Enter Keystore details first");
                break;
-            case 4:
+            case 4: //Check if domain exists
                if(pwm.keyStoreExists())
                {
                   System.out.println("Enter security domain to enquire:");
@@ -157,9 +162,25 @@
                break; 
             default: System.exit(0);
          }
-      }
+      } 
    } 
    
+   private static void load()
+   {
+      try
+      {
+          pwm.load();
+      }
+      catch(FileNotFoundException ignore)
+      {
+         
+      }
+      catch(Exception e)
+      {
+         e.printStackTrace();
+      } 
+   }
+   
    /**
     * A shutdown hook that 
     * stores the password map 




More information about the jboss-cvs-commits mailing list