use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.
the class TestWSSecurity method test120AddUserNobodyAsAdministrator.
@Test
public void test120AddUserNobodyAsAdministrator() throws Exception {
final String TEST_NAME = "test120AddUserNobodyAsAdministrator";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
modelPort = createModelPort(USER_ADMINISTRATOR_USERNAME, USER_ADMINISTRATOR_PASSWORD, WSConstants.PW_DIGEST);
UserType userNobody = ModelClientUtil.unmarshallFile(USER_NOBODY_FILE);
XMLGregorianCalendar startTs = TestUtil.currentTime();
// WHEN
String userNobodyOid = addObject(userNobody);
// THEN
XMLGregorianCalendar endTs = TestUtil.currentTime();
tailer.tail();
displayAudit(tailer);
assertAuditLoginLogout(tailer);
assertAuditIds(tailer);
assertAuditOperation(tailer, "ADD_OBJECT");
tailer.assertAudit(4);
// GET user
UserType userNobodyAfter = getObject(UserType.class, userNobodyOid);
display(userNobodyAfter);
assertUser(userNobodyAfter, userNobodyOid, USER_NOBODY_USERNAME, USER_NOBODY_GIVEN_NAME, USER_NOBODY_FAMILY_NAME);
assertPasswordCreateMetadata(userNobodyAfter, USER_ADMINISTRATOR_OID, startTs, endTs);
}
use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.
the class TestWSSecurity method test166GetConfigAsDarthAdder.
/**
* Darth Adder has no password.
*/
@Test
public void test166GetConfigAsDarthAdder() throws Exception {
final String TEST_NAME = "test166GetConfigAsDarthAdder";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
modelPort = createModelPort(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD_NEW2, WSConstants.PW_DIGEST);
Holder<ObjectType> objectHolder = new Holder<ObjectType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
try {
/// WHEN
modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, objectHolder, resultHolder);
AssertJUnit.fail("Unexpected success");
} catch (SOAPFaultException e) {
assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");
}
// THEN
tailer.tail();
assertAuditLoginFailed(tailer, "no credentials in user");
}
use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.
the class TestWSSecurity method test142DisableHimselfAsDarthAdder.
@Test
public void test142DisableHimselfAsDarthAdder() throws Exception {
final String TEST_NAME = "test142DisableHimselfAsDarthAdder";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(UserType.class, USER_DARTHADDER_OID, "activation/administrativeStatus", ModificationTypeType.REPLACE, ActivationStatusType.DISABLED);
// WHEN
ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);
// THEN
assertSuccess(deltaOpList);
tailer.tail();
displayAudit(tailer);
assertAuditLoginLogout(tailer);
assertAuditIds(tailer);
assertAuditOperation(tailer, "MODIFY_OBJECT");
tailer.assertAudit(4);
modelPort = createModelPort();
UserType user = getObject(UserType.class, USER_DARTHADDER_OID);
display(user);
assertEquals("Wrong administrative status in " + ModelClientUtil.toString(user), ActivationStatusType.DISABLED, user.getActivation().getAdministrativeStatus());
}
use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.
the class TestWSSecurity method test101GetConfigWrongPasswordDigest.
@Test
public void test101GetConfigWrongPasswordDigest() throws Exception {
final String TEST_NAME = "test101GetConfigWrongPasswordDigest";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
modelPort = createModelPort(USER_ADMINISTRATOR_USERNAME, "wrongAdministratorPassword", WSConstants.PW_DIGEST);
Holder<ObjectType> objectHolder = new Holder<ObjectType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
// WHEN
try {
modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, objectHolder, resultHolder);
AssertJUnit.fail("Unexpected success");
} catch (SOAPFaultException e) {
assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");
}
tailer.tail();
assertAuditLoginFailed(tailer, "could not be authenticated or authorized");
}
use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.
the class TestWSSecurity method test102GetConfigWrongPasswordText.
@Test
public void test102GetConfigWrongPasswordText() throws Exception {
final String TEST_NAME = "test102GetConfigWrongPasswordText";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
modelPort = createModelPort(USER_ADMINISTRATOR_USERNAME, "wrongAdministratorPassword", WSConstants.PW_TEXT);
Holder<ObjectType> objectHolder = new Holder<ObjectType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
// WHEN
try {
modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, objectHolder, resultHolder);
AssertJUnit.fail("Unexpected success");
} catch (SOAPFaultException e) {
assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");
}
}
Aggregations