1 13 14 package org.ejbca.ui.cli; 15 16 import org.ejbca.core.model.authorization.AuthorizationDeniedException; 17 import org.ejbca.core.model.ra.raadmin.UserDoesntFullfillEndEntityProfile; 18 19 20 21 27 public class RaSetClearPwdCommand extends BaseRaAdminCommand { 28 33 public RaSetClearPwdCommand(String [] args) { 34 super(args); 35 } 36 37 43 public void execute() throws IllegalAdminCommandException, ErrorAdminCommandException { 44 try { 45 if (args.length < 3) { 46 getOutputStream().println("Usage: RA setclearpwd <username> <password>"); 47 48 return; 49 } 50 51 String username = args[1]; 52 String password = args[2]; 53 getOutputStream().println("Setting clear text password " + password + " for user " + username); 54 55 try { 56 getAdminSession().setClearTextPassword(administrator, username, password); 57 } catch (AuthorizationDeniedException e) { 58 getOutputStream().println("Error : Not authorized to change userdata."); 59 } catch (UserDoesntFullfillEndEntityProfile e) { 60 getOutputStream().println("Error : Given userdata doesn't fullfill end entity profile. : " + 61 e.getMessage()); 62 } 63 } catch (Exception e) { 64 throw new ErrorAdminCommandException(e); 65 } 66 } 67 68 } 70 | Popular Tags |