List of usage examples for java.lang SecurityException getMessage
public String getMessage()
From source file:org.apache.directory.fortress.core.AuditMgrConsole.java
/** * //from www. j a v a 2 s.co m */ void getModReport() { ReaderUtil.clearScreen(); try { UserAudit uAudit = new UserAudit(); System.out.println("Enter userId to search Audit Mods with:"); String val = ReaderUtil.readLn(); if (StringUtils.isNotEmpty(val)) { uAudit.setUserId(val); System.out.println("size=" + val.length() + " val=" + val); } else { System.out.println("val is empty or null"); } System.out.println("Check within the last n hours? Enter number of hours or null for unlimited"); val = ReaderUtil.readLn(); if (val != null && val.length() > 0) { int hours = Integer.parseInt(val); Date date = new Date(); long millis = date.getTime(); millis = millis - (1000 * 60 * 60 * hours); Date date2 = new Date(millis); uAudit.setBeginDate(date2); } List<Mod> list = am.searchUserSessions(uAudit); printMods(list); System.out.println("ENTER to continue"); } catch (SecurityException e) { LOG.error("getModReport caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e); } ReaderUtil.readChar(); }
From source file:org.apache.directory.fortress.core.ReviewMgrConsole.java
/** * Description of the Method/*from ww w .j a v a 2 s . c o m*/ */ protected void displayUsers() { try { User ue; ArrayList list = (ArrayList) rm.findUsers(new User()); int size = list.size(); for (int i = 0; i < size; i++) { ue = (User) list.get(i); System.out.println("USER[" + i + "]"); System.out.println(" userId [" + ue.getUserId() + "]"); System.out.println(" internalId [" + ue.getInternalId() + "]"); System.out.println(" description [" + ue.getDescription() + "]"); System.out.println(" common name [" + ue.getCn() + "]"); System.out.println(" surname [" + ue.getSn() + "]"); System.out.println(" orgUnitId [" + ue.getOu() + "]"); System.out.println(" pwpolicy [" + ue.getPwPolicy() + "]"); printTemporal(ue, "USER"); printPosixAccount(ue, "POSIX"); printAddress(ue.getAddress(), "ADDRESS"); printPhone(ue.getPhones(), "PHONES"); printPhone(ue.getMobiles(), "MOBILES"); if (ue.getRoles() != null) { for (UserRole ur : ue.getRoles()) { printTemporal(ur, "RBACROLE"); } } if (ue.getAdminRoles() != null) { for (UserAdminRole ur : ue.getAdminRoles()) { printAdminRole(ur); printTemporal(ur, "ADMINROLE"); } } System.out.println(); } System.out.println("ENTER to continue"); } catch (SecurityException e) { LOG.error("displayUsers caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e); } ReaderUtil.readChar(); }
From source file:org.apache.directory.fortress.core.AuditMgrConsole.java
public AuditMgrConsole() { try {//from w ww . j av a2s. co m am = AuditMgrFactory.createInstance(TestUtils.getContext()); } catch (org.apache.directory.fortress.core.SecurityException e) { LOG.error(" constructor caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e); } }
From source file:org.apache.directory.fortress.core.AuditMgrConsole.java
/** * */// w w w .j a v a 2 s . c o m void getAuthReport() { ReaderUtil.clearScreen(); try { UserAudit uAudit = new UserAudit(); System.out.println("Enter userId to search Audit AuthZs with:"); String val = ReaderUtil.readLn(); if (StringUtils.isNotEmpty(val)) { uAudit.setUserId(val); System.out.println("size=" + val.length() + " val=" + val); } else { System.out.println("val is empty or null"); } //uAudit.setUserId(val); System.out.println("Check for failed only? (Enter 'Y' for yes or 'N' for no"); val = ReaderUtil.readLn(); if (val.equalsIgnoreCase("Y")) uAudit.setFailedOnly(true); System.out.println("Check within the last n hours? Enter number of hours or null for unlimited"); val = ReaderUtil.readLn(); if (val != null && val.length() > 0) { int hours = Integer.parseInt(val); Date date = new Date(); long millis = date.getTime(); millis = millis - (1000 * 60 * 60 * hours); Date date2 = new Date(millis); uAudit.setBeginDate(date2); } List<AuthZ> list = am.getUserAuthZs(uAudit); printAuthZReport(list); System.out.println("ENTER to continue"); } catch (SecurityException e) { LOG.error("getAuthReport caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e); } ReaderUtil.readChar(); }
From source file:org.apache.directory.fortress.core.ReviewMgrConsole.java
void permissionUsers() { Permission pe;// w ww . j a va2s.c o m try { Permission permission = new Permission(); ReaderUtil.clearScreen(); System.out.println("Enter perm object name:"); String name = ReaderUtil.readLn(); permission.setObjName(name); System.out.println("Enter perm object id or null for none:"); String oid = ReaderUtil.readLn(); permission.setObjId(oid); System.out.println("Enter perm operation name:"); String op = ReaderUtil.readLn(); permission.setOpName(op); pe = rm.readPermission(permission); if (pe != null) { //System.out.println("perm operation [" + pe.operation + "]"); System.out.println("object name [" + pe.getObjName() + "]"); System.out.println("object id [" + pe.getObjId() + "]"); System.out.println("operation name [" + pe.getOpName() + "]"); System.out.println("abstract perm name [" + pe.getAbstractName() + "]"); System.out.println("internalId [" + pe.getInternalId() + "]"); if (pe.getUsers() != null && pe.getUsers().size() > 0) { int ctr = 0; for (String user : pe.getUsers()) { System.out.println("user[" + ctr++ + "]=" + user); } } System.out.println("**"); System.out.println("read operation complete"); System.out.println("ENTER to continue"); } } catch (SecurityException e) { LOG.error("permissionUsers caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e); } ReaderUtil.readChar(); }
From source file:org.apache.directory.fortress.core.ReviewMgrConsole.java
/** * Description of the Method//from w w w. j ava 2 s. co m */ void permissionRoles() { Permission pe; try { Permission permission = new Permission(); ReaderUtil.clearScreen(); System.out.println("Enter perm object name:"); String name = ReaderUtil.readLn(); permission.setObjName(name); System.out.println("Enter perm object id or null for none:"); String oid = ReaderUtil.readLn(); permission.setObjId(oid); System.out.println("Enter perm operation name:"); String op = ReaderUtil.readLn(); permission.setOpName(op); pe = rm.readPermission(permission); if (pe != null) { //System.out.println("perm operation [" + pe.operation + "]"); System.out.println("object name [" + pe.getObjName() + "]"); System.out.println("object id [" + pe.getObjId() + "]"); System.out.println("operation name [" + pe.getOpName() + "]"); System.out.println("abstract perm name [" + pe.getAbstractName() + "]"); System.out.println("internalId [" + pe.getInternalId() + "]"); if (pe.getRoles() != null && pe.getRoles().size() > 0) { int ctr = 0; for (String role : pe.getRoles()) { System.out.println("name[" + ctr++ + "]=" + role); } } System.out.println("**"); System.out.println("read operation complete"); System.out.println("ENTER to continue"); } } catch (SecurityException e) { LOG.error("permissionRoles caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e); } ReaderUtil.readChar(); }
From source file:org.apache.directory.fortress.core.ReviewMgrConsole.java
/** * Constructor for the ReviewMgrConsole object */// www . j ava 2 s. c o m ReviewMgrConsole() { try { rm = ReviewMgrFactory.createInstance(TestUtils.getContext()); } catch (org.apache.directory.fortress.core.SecurityException e) { LOG.error(" constructor caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e); } }
From source file:org.apache.directory.fortress.core.ReviewMgrConsole.java
/** * Description of the Method/*from w ww.j a v a2s .c o m*/ */ void readUser() { String userId; ReaderUtil.clearScreen(); try { System.out.println("Enter UserId to read:"); userId = ReaderUtil.readLn(); User user = new User(); user.setUserId(userId); User ue = rm.readUser(user); if (ue != null) { System.out.println("USER OBJECT:"); System.out.println(" userId [" + ue.getUserId() + "]"); System.out.println(" internalId [" + ue.getInternalId() + "]"); System.out.println(" description [" + ue.getDescription() + "]"); System.out.println(" common name [" + ue.getCn() + "]"); System.out.println(" surname [" + ue.getSn() + "]"); System.out.println(" orgUnitId [" + ue.getOu() + "]"); System.out.println(" pwpolicy [" + ue.getPwPolicy() + "]"); printPosixAccount(ue, "POSIX"); printTemporal(ue, "USER"); if (ue.getRoles() != null) { for (UserRole ur : ue.getRoles()) { printTemporal(ur, "RBACROLE"); } } if (ue.getAdminRoles() != null) { for (UserAdminRole ur : ue.getAdminRoles()) { printAdminRole(ur); printTemporal(ur, "ADMINROLE"); } } if (ue.getProperties() != null && ue.getProperties().size() > 0) { int ctr = 0; for (Enumeration e = ue.getProperties().propertyNames(); e.hasMoreElements();) { String key = (String) e.nextElement(); String val = ue.getProperty(key); System.out.println("prop key[" + ctr + "]=" + key); System.out.println("prop value[" + ctr++ + "]=" + val); } } } else { System.out.println(" user [" + userId + "] was not found"); } System.out.println("ENTER to continue"); } catch (SecurityException e) { LOG.error("readUser caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e); } ReaderUtil.readChar(); }
From source file:org.apache.directory.fortress.core.ReviewMgrConsole.java
void getUser() { String userVal;/* ww w. j a v a2 s . c om*/ ReaderUtil.clearScreen(); try { System.out.println("Enter Internal id for user:"); userVal = ReaderUtil.readLn(); User ue = new User(); ue.setInternalId(userVal); ArrayList list = (ArrayList) rm.findUsers(ue); int size = list.size(); for (int i = 0; i < size; i++) { ue = (User) list.get(i); System.out.println("USER[" + i + "]"); System.out.println(" userId [" + ue.getUserId() + "]"); System.out.println(" internalId [" + ue.getInternalId() + "]"); System.out.println(" description [" + ue.getDescription() + "]"); System.out.println(" common name [" + ue.getCn() + "]"); System.out.println(" surname [" + ue.getSn() + "]"); System.out.println(" orgUnitId [" + ue.getOu() + "]"); System.out.println(" pwpolicy [" + ue.getPwPolicy() + "]"); printTemporal(ue, "USER"); printPosixAccount(ue, "POSIX"); printAddress(ue.getAddress(), "ADDRESS"); printPhone(ue.getPhones(), "PHONES"); printPhone(ue.getMobiles(), "MOBILES"); if (ue.getRoles() != null) { for (UserRole ur : ue.getRoles()) { printTemporal(ur, "RBACROLE"); } } if (ue.getAdminRoles() != null) { for (UserAdminRole ur : ue.getAdminRoles()) { printAdminRole(ur); printTemporal(ur, "ADMINROLE"); } } if (ue.getProperties() != null && ue.getProperties().size() > 0) { int ctr = 0; for (Enumeration e = ue.getProperties().propertyNames(); e.hasMoreElements();) { String key = (String) e.nextElement(); String val = ue.getProperty(key); System.out.println("prop key[" + ctr + "]=" + key); System.out.println("prop value[" + ctr++ + "]=" + val); } } System.out.println(); } System.out.println("ENTER to continue"); } catch (SecurityException e) { LOG.error("getUser caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e); } ReaderUtil.readChar(); }
From source file:org.apache.directory.fortress.core.ReviewMgrConsole.java
/** * *///from ww w . ja v a2 s . c o m void rolePermissions() { try { System.out.println("Enter role name:"); String name = ReaderUtil.readLn(); List<Permission> list = rm.rolePermissions(new Role(name)); if (list != null) { int ctr = 0; for (Permission pe : list) { System.out.println("**perm:" + (++ctr) + "***"); //System.out.println("perm operation [" + pe.operation + "]"); System.out.println("object name [" + pe.getObjName() + "]"); System.out.println("object id [" + pe.getObjId() + "]"); System.out.println("operation name [" + pe.getOpName() + "]"); System.out.println("abstract perm name [" + pe.getAbstractName() + "]"); System.out.println("internalId [" + pe.getInternalId() + "]"); if (pe.getUsers() != null && pe.getUsers().size() > 0) { int ctr2 = 0; for (String user : pe.getUsers()) { System.out.println("user[" + ctr2++ + "]=" + user); } } if (pe.getRoles() != null && pe.getRoles().size() > 0) { int ctr2 = 0; for (String role : pe.getRoles()) { System.out.println("name[" + ctr2++ + "]=" + role); } } if (pe.getProperties() != null && pe.getProperties().size() > 0) { int pctr = 0; for (Enumeration e = pe.getProperties().propertyNames(); e.hasMoreElements();) { String key = (String) e.nextElement(); String val = pe.getProperty(key); System.out.println("prop key[" + pctr + "]=" + key); System.out.println("prop value[" + pctr++ + "]=" + val); } } //prettyPrintFinePermissions(pe.getFinePerms()); System.out.println("**"); } System.out.println("search complete"); System.out.println("ENTER to continue"); } } catch (SecurityException e) { LOG.error("rolePermissions caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e); } ReaderUtil.readChar(); }