Search in sources :

Example 96 with Holder

use of javax.xml.ws.Holder 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");
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Holder(javax.xml.ws.Holder) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.testng.annotations.Test)

Example 97 with Holder

use of javax.xml.ws.Holder 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");
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Holder(javax.xml.ws.Holder) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.testng.annotations.Test)

Example 98 with Holder

use of javax.xml.ws.Holder 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");
    }
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Holder(javax.xml.ws.Holder) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.testng.annotations.Test)

Example 99 with Holder

use of javax.xml.ws.Holder in project midpoint by Evolveum.

the class TestWSSecurity method test103GetConfigEmptyPasswordDigest.

@Test
public void test103GetConfigEmptyPasswordDigest() throws Exception {
    final String TEST_NAME = "test103GetConfigEmptyPasswordDigest";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_ADMINISTRATOR_USERNAME, "", 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");
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Holder(javax.xml.ws.Holder) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.testng.annotations.Test)

Example 100 with Holder

use of javax.xml.ws.Holder in project midpoint by Evolveum.

the class AbstractWebserviceTest method cleanObjects.

private <O extends ObjectType> void cleanObjects(Class<O> type, boolean raw, String... protectedOids) throws FaultMessage {
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
    Holder<ObjectListType> objectListHolder = new Holder<ObjectListType>();
    SelectorQualifiedGetOptionsType rootOpts = null;
    ModelExecuteOptionsType execOpts = null;
    if (raw) {
        rootOpts = ModelClientUtil.createRootGetOptions(ModelClientUtil.createRawGetOption());
        execOpts = ModelClientUtil.createRawExecuteOption();
    }
    modelPort.searchObjects(getTypeQName(type), null, rootOpts, objectListHolder, resultHolder);
    List<String> protectedOidList = Arrays.asList(protectedOids);
    ObjectListType objectList = objectListHolder.value;
    for (ObjectType object : objectList.getObject()) {
        if (!protectedOidList.contains(object.getOid())) {
            display("Deleting " + type.getSimpleName() + " " + ModelClientUtil.toString(object));
            deleteObject(type, object.getOid(), execOpts);
        }
    }
}
Also used : Holder(javax.xml.ws.Holder) ObjectListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType) SelectorQualifiedGetOptionsType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.SelectorQualifiedGetOptionsType)

Aggregations

Holder (javax.xml.ws.Holder)129 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)77 Test (org.testng.annotations.Test)53 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)48 SelectorQualifiedGetOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)33 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)29 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)29 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)24 ObjectListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType)23 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)23 Test (org.junit.Test)23 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)21 LogfileTestTailer (com.evolveum.midpoint.test.util.LogfileTestTailer)21 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)19 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)18 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)16 GenericObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.GenericObjectType)15 CountDownLatch (java.util.concurrent.CountDownLatch)15 IpPort (io.servicecomb.foundation.common.net.IpPort)14 ClientException (io.servicecomb.serviceregistry.client.ClientException)14