1 13 14 package org.ejbca.ui.cli; 15 16 import org.ejbca.core.model.authorization.AuthorizationDeniedException; 17 import org.ejbca.core.model.ra.UserDataVO; 18 19 20 21 22 23 28 public class RaFindUserCommand extends BaseRaAdminCommand { 29 34 public RaFindUserCommand(String [] args) { 35 super(args); 36 } 37 38 44 public void execute() throws IllegalAdminCommandException, ErrorAdminCommandException { 45 try { 46 if (args.length < 2) { 47 getOutputStream().println("Usage: RA finduser <username>"); 48 49 return; 50 } 51 52 String username = args[1]; 53 54 try { 55 UserDataVO data = getAdminSession().findUser(administrator, username); 56 57 if (data != null) { 58 getOutputStream().println("Found user:"); 59 getOutputStream().println("username=" + data.getUsername()); 60 getOutputStream().println("password=" + data.getPassword()); 61 getOutputStream().println("dn: \"" + data.getDN() + "\""); 62 getOutputStream().println("altName: \"" + data.getSubjectAltName() + "\""); 63 getOutputStream().println("directoryAttributes: \"" + data.getExtendedinformation().getSubjectDirectoryAttributes() + "\""); 64 getOutputStream().println("email=" + data.getEmail()); 65 getOutputStream().println("status=" + data.getStatus()); 66 getOutputStream().println("type=" + data.getType()); 67 getOutputStream().println("token type=" + data.getTokenType()); 68 getOutputStream().println("end entity profile id=" + data.getEndEntityProfileId()); 69 getOutputStream().println("certificate entity profile id=" + 70 data.getCertificateProfileId()); 71 getOutputStream().println("hard token issuer id=" + data.getHardTokenIssuerId()); 72 getOutputStream().println("created=" + data.getTimeCreated()); 73 getOutputStream().println("modified=" + data.getTimeModified()); 74 } else { 75 getOutputStream().println("User '" + username + "' does not exist."); 76 } 77 } catch (AuthorizationDeniedException e) { 78 getOutputStream().println("Error : Not authorized to view user."); 79 } 80 } catch (Exception e) { 81 throw new ErrorAdminCommandException(e); 82 } 83 } 84 85 } 87 | Popular Tags |