use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.
the class TestWSSecurity method test111GetConfigGoodPasswordText.
@Test
public void test111GetConfigGoodPasswordText() throws Exception {
final String TEST_NAME = "test111GetConfigGoodPasswordText";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
modelPort = createModelPort(USER_ADMINISTRATOR_USERNAME, USER_ADMINISTRATOR_PASSWORD, WSConstants.PW_TEXT);
Holder<ObjectType> objectHolder = new Holder<ObjectType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
// WHEN
modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, objectHolder, resultHolder);
// THEN
assertSuccess(resultHolder);
tailer.tail();
assertAuditLoginLogout(tailer);
assertAuditIds(tailer);
tailer.assertAudit(2);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.
the class TestWSSecurity method test108GetConfigBlankUsernameText.
@Test
public void test108GetConfigBlankUsernameText() throws Exception {
final String TEST_NAME = "test108GetConfigBlankUsernameText";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
modelPort = createModelPort(" ", USER_ADMINISTRATOR_PASSWORD, 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");
}
tailer.tail();
assertAuditLoginFailed(tailer, "no username");
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.
the class TestWSSecurity method test100GetConfigNoSecurity.
@Test
public void test100GetConfigNoSecurity() throws Exception {
final String TEST_NAME = "test100GetConfigNoSecurity";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
modelPort = createModelPort(null, null);
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, "InvalidSecurity", "<wsse:Security> header");
}
tailer.tail();
assertAuditLoginFailed(tailer, "<wsse:Security> header");
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.
the class TestWSSecurity method test143GetConfigAsDarthAdderGoodPasswordDigest.
@Test
public void test143GetConfigAsDarthAdderGoodPasswordDigest() throws Exception {
final String TEST_NAME = "test143GetConfigAsDarthAdderGoodPasswordDigest";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
modelPort = createModelPort(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD, 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, "user disabled");
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType in project midpoint by Evolveum.
the class ReportWebServiceRaw method invokeAllowingFaults.
public DOMSource invokeAllowingFaults(DOMSource request) throws FaultMessage {
Node rootNode = request.getNode();
Element rootElement;
if (rootNode instanceof Document) {
rootElement = ((Document) rootNode).getDocumentElement();
} else if (rootNode instanceof Element) {
rootElement = (Element) rootNode;
} else {
// throw ws.createIllegalArgumentFault("Unexpected DOM node type: " + rootNode);
throw new FaultMessage("Unexpected DOM node type: " + rootNode);
}
Object requestObject;
try {
requestObject = prismContext.parserFor(rootElement).parseRealValue();
} catch (SchemaException e) {
throw new FaultMessage("Couldn't parse SOAP request body because of schema exception: " + e.getMessage());
// throw ws.createIllegalArgumentFault("Couldn't parse SOAP request body because of schema exception: " + e.getMessage());
}
Node response;
Holder<OperationResultType> operationResultTypeHolder = new Holder<>();
SerializationContext ctx = new SerializationContext(SerializationOptions.createSerializeReferenceNames());
try {
if (requestObject instanceof EvaluateScriptType) {
EvaluateScriptType s = (EvaluateScriptType) requestObject;
ObjectListType olt = reportService.evaluateScript(s.getScript(), s.getParameters());
EvaluateScriptResponseType sr = new EvaluateScriptResponseType();
sr.setObjectList(olt);
response = prismContext.domSerializer().context(ctx).serializeAnyData(sr, ReportPort.EVALUATE_SCRIPT_RESPONSE);
} else if (requestObject instanceof EvaluateAuditScriptType) {
EvaluateAuditScriptType s = (EvaluateAuditScriptType) requestObject;
AuditEventRecordListType olt = reportService.evaluateAuditScript(s.getScript(), s.getParameters());
EvaluateAuditScriptResponseType sr = new EvaluateAuditScriptResponseType();
sr.setObjectList(olt);
response = prismContext.domSerializer().context(ctx).serializeAnyData(sr, ReportPort.EVALUATE_AUDIT_SCRIPT_RESPONSE);
} else if (requestObject instanceof ProcessReportType) {
ProcessReportType p = (ProcessReportType) requestObject;
ObjectListType olt = reportService.processReport(p.getQuery(), p.getParameters(), p.getOptions());
ProcessReportResponseType pr = new ProcessReportResponseType();
pr.setObjectList(olt);
response = prismContext.domSerializer().context(ctx).serializeAnyData(pr, ReportPort.PROCESS_REPORT_RESPONSE);
} else {
throw new FaultMessage("Unsupported request type: " + requestObject);
}
} catch (SchemaException e) {
throwFault(e, operationResultTypeHolder.value);
// not reached
return null;
}
return new DOMSource(response);
}
Aggregations