use of org.apache.directory.fortress.core.AuditMgr in project directory-fortress-core by apache.
the class AuditMgrImplTest method searchBinds.
/**
* @param msg
* @param uArray
*/
private static void searchBinds(String msg, String[][] uArray) {
LogUtil.logIt(msg);
try {
AuditMgr auditMgr = getManagedAuditMgr();
for (String[] usr : uArray) {
User user = UserTestData.getUser(usr);
// now search for successful authentications:
UserAudit uAudit = new UserAudit();
uAudit.setUserId(user.getUserId());
uAudit.setFailedOnly(false);
List<Bind> binds = auditMgr.searchBinds(uAudit);
assertNotNull(binds);
assertTrue(CLS_NM + "searchBinds failed search for successful authentication user [" + user.getUserId() + "]", binds.size() > 0);
// now search for failed authentications:
uAudit.setFailedOnly(true);
binds = auditMgr.searchBinds(uAudit);
assertNotNull(binds);
assertTrue(CLS_NM + "searchBinds failed search for failed authentication user [" + user.getUserId() + "]", binds.size() > 0);
}
LOG.debug("searchBinds successful");
} catch (SecurityException ex) {
LOG.error("searchBinds: failed with SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.AuditMgr in project directory-fortress-core by apache.
the class AuditMgrImplTest method getAuthZs.
/**
* @param msg
* @param uArray
*/
private static void getAuthZs(String msg, String[][] uArray) {
LogUtil.logIt(msg);
try {
AuditMgr auditMgr = getManagedAuditMgr();
for (String[] usr : uArray) {
User user = UserTestData.getUser(usr);
// now search for successful authentications:
UserAudit uAudit = new UserAudit();
uAudit.setUserId(user.getUserId());
uAudit.setFailedOnly(false);
List<AuthZ> authZs = auditMgr.getUserAuthZs(uAudit);
assertNotNull(authZs);
assertTrue(CLS_NM + "getUserAuthZs failed search for successful authorization user [" + user.getUserId() + "]", authZs.size() > 0);
// now search for failed authentications:
uAudit.setFailedOnly(true);
authZs = auditMgr.getUserAuthZs(uAudit);
assertNotNull(authZs);
assertTrue(CLS_NM + "getUserAuthZs failed search for failed authorization user [" + user.getUserId() + "]", authZs.size() > 0);
}
LOG.debug("getUserAuthZs successful");
} catch (SecurityException ex) {
LOG.error("getUserAuthZs: failed with SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.AuditMgr in project directory-fortress-core by apache.
the class AuditMgrImplTest method searchAuthZs.
/**
* @param msg
* @param uArray
*/
private static void searchAuthZs(String msg, String[][] uArray, String[][] oArray, String[][] opArray, boolean failedOnly) {
LogUtil.logIt(msg);
try {
AuditMgr auditMgr = getManagedAuditMgr();
for (String[] usr : uArray) {
User user = UserTestData.getUser(usr);
// now search for successful authentications:
UserAudit uAudit = new UserAudit();
uAudit.setUserId(user.getUserId());
uAudit.setFailedOnly(false);
for (String[] obj : oArray) {
uAudit.setObjName(PermTestData.getName(obj));
for (String[] op : opArray) {
uAudit.setOpName(PermTestData.getName(op));
uAudit.setObjId(PermTestData.getObjId(op));
uAudit.setFailedOnly(failedOnly);
List<AuthZ> authZs = auditMgr.searchAuthZs(uAudit);
assertNotNull(authZs);
assertTrue(CLS_NM + "searchAuthZs failedOnly=" + failedOnly + ", search authorizations user [" + user.getUserId() + "], objName [" + uAudit.getObjName() + "], opName [" + uAudit.getOpName() + "], objId [" + uAudit.getObjId() + "]", authZs.size() > 0);
}
}
}
LOG.debug("searchAuthZs successful");
} catch (SecurityException ex) {
LOG.error("searchAuthZs: failed with SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.AuditMgr in project directory-fortress-core by apache.
the class AuditMgrImplTest method searchAuthNInvalid.
/**
* @param msg
*/
private static void searchAuthNInvalid(String msg) {
LogUtil.logIt(msg);
try {
AuditMgr auditMgr = getManagedAuditMgr();
UserAudit uAudit = new UserAudit();
List<AuthZ> resultSet = auditMgr.searchInvalidUsers(uAudit);
assertNotNull(resultSet);
assertTrue(CLS_NM + "searchInvalidUsers failed search for invalid authentications", resultSet.size() > 0);
LOG.debug("searchInvalidUsers successful");
} catch (SecurityException ex) {
LOG.error("searchInvalidUsers: failed with SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.AuditMgr in project directory-fortress-core by apache.
the class AuditMgrImplTest method searchMods.
/**
* @param msg
* @param uArray
*/
private static void searchMods(String msg, String[][] uArray) {
LogUtil.logIt(msg);
try {
AuditMgr auditMgr = getManagedAuditMgr();
for (String[] usr : uArray) {
User user = UserTestData.getUser(usr);
// now search for successful session creation events:
UserAudit uAudit = new UserAudit();
uAudit.setUserId(user.getUserId());
uAudit.setFailedOnly(false);
List<Mod> mods = auditMgr.searchUserSessions(uAudit);
assertNotNull(mods);
assertTrue(CLS_NM + "searchUserSessions failed search for successful authentication user [" + user.getUserId() + "]", mods.size() > 0);
}
LOG.debug("searchUserSessions successful");
} catch (SecurityException ex) {
LOG.error("searchUserSessions: failed with SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations