[jboss-cvs] JBossAS SVN: r88763 - trunk/security/src/main/org/jboss/security/integration/password.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 12 13:31:00 EDT 2009
Author: anil.saldhana at jboss.com
Date: 2009-05-12 13:31:00 -0400 (Tue, 12 May 2009)
New Revision: 88763
Modified:
trunk/security/src/main/org/jboss/security/integration/password/PasswordTool.java
Log:
JBAS-6710: merge 88676 from Branch_5_x
Modified: trunk/security/src/main/org/jboss/security/integration/password/PasswordTool.java
===================================================================
--- trunk/security/src/main/org/jboss/security/integration/password/PasswordTool.java 2009-05-12 17:25:18 UTC (rev 88762)
+++ trunk/security/src/main/org/jboss/security/integration/password/PasswordTool.java 2009-05-12 17:31:00 UTC (rev 88763)
@@ -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