Search in sources :

Example 16 with SOAPFaultException

use of javax.xml.ws.soap.SOAPFaultException 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");
}
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 17 with SOAPFaultException

use of javax.xml.ws.soap.SOAPFaultException in project wildfly by wildfly.

the class EJBEndpoint method helloError.

public String helloError(String input) {
    try {
        SOAPFault fault = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createFault(input, SOAPConstants.SOAP_VERSIONMISMATCH_FAULT);
        fault.setFaultActor("mr.actor");
        fault.addDetail().addChildElement("test");
        fault.appendFaultSubcode(new QName("http://ws.gss.redhat.com/", "NullPointerException"));
        fault.appendFaultSubcode(new QName("http://ws.gss.redhat.com/", "OperatorNotFound"));
        throw new SOAPFaultException(fault);
    } catch (SOAPException ex) {
        ex.printStackTrace();
    }
    return "Failure!";
}
Also used : QName(javax.xml.namespace.QName) SOAPException(javax.xml.soap.SOAPException) SOAPFault(javax.xml.soap.SOAPFault) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException)

Example 18 with SOAPFaultException

use of javax.xml.ws.soap.SOAPFaultException in project wildfly by wildfly.

the class SignEncryptMultipleClientsTestCase method encryptedAndSignedRequestFromUntrustedMax.

/*
     * Max's public key is not trusted in Bob's keystore
     * Max's keystore contain's Bob's public key as trusted.
     */
@Test
public void encryptedAndSignedRequestFromUntrustedMax() throws Exception {
    QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "EncryptSecurityService");
    URL wsdlURL = new URL(baseUrl.toString() + "EncryptSecurityService?wsdl");
    //use a new bus to avoid any possible clash with other tests
    Service service = Service.create(wsdlURL, serviceName, new UseNewBusFeature());
    ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
    setupWsse(proxy, "max");
    try {
        proxy.sayHello();
        Assert.fail("Max shouldn't invoke this service");
    } catch (SOAPFaultException ex) {
    // expected failure because max isn't trusted
    }
}
Also used : ServiceIface(org.jboss.as.test.integration.ws.wsse.ServiceIface) QName(javax.xml.namespace.QName) UseNewBusFeature(org.jboss.wsf.stack.cxf.client.UseNewBusFeature) Service(javax.xml.ws.Service) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) URL(java.net.URL) Test(org.junit.Test)

Example 19 with SOAPFaultException

use of javax.xml.ws.soap.SOAPFaultException in project midpoint by Evolveum.

the class TestWSSecurity method test107GetConfigBlankUsernameDigest.

@Test
public void test107GetConfigBlankUsernameDigest() throws Exception {
    final String TEST_NAME = "test107GetConfigBlankUsernameDigest";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(" ", USER_ADMINISTRATOR_PASSWORD, 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, "no username");
}
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 20 with SOAPFaultException

use of javax.xml.ws.soap.SOAPFaultException 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)

Aggregations

SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)31 LogfileTestTailer (com.evolveum.midpoint.test.util.LogfileTestTailer)21 Test (org.testng.annotations.Test)21 Holder (javax.xml.ws.Holder)18 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)17 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)17 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)17 QName (javax.xml.namespace.QName)7 URL (java.net.URL)5 Test (org.junit.Test)5 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)4 SOAPException (javax.xml.soap.SOAPException)4 SOAPFault (javax.xml.soap.SOAPFault)4 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)3 IOException (java.io.IOException)3 Service (javax.xml.ws.Service)3 JAXBElement (javax.xml.bind.JAXBElement)2 RuntimeCamelException (org.apache.camel.RuntimeCamelException)2 ServiceIface (org.jboss.as.test.integration.ws.wsse.ServiceIface)2 UseNewBusFeature (org.jboss.wsf.stack.cxf.client.UseNewBusFeature)2