001package co.codewizards.cloudstore.client; 002 003import org.kohsuke.args4j.Argument; 004 005import co.codewizards.cloudstore.core.otp.LdapPasswordOneTimePadRegistry; 006import co.codewizards.cloudstore.core.otp.OneTimePadRegistry; 007/** 008 * {@link SubCommand} implementation for changing LDAP admin password. 009 * @author wilk 010 */ 011public class ChangeLdapPasswordSubCommand extends SubCommand{ 012 013 @Argument(metaVar="<password>", index = 0, required=true, usage="New LDAP admin password") 014 private String password; 015 016 @Override 017 public String getSubCommandDescription() { 018 return "Change LDAP admin password."; 019 } 020 021 @Override 022 public void run() throws Exception { 023 OneTimePadRegistry registry = new LdapPasswordOneTimePadRegistry(); 024 registry.encryptAndStorePassword(password.toCharArray()); 025 System.out.println("LDAP admin password changed successfully."); 026 } 027 028}