Examples of WSS4JOutInterceptor


Examples of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

            "org/apache/cxf/systest/ws/policy/client/javafirstclient.xml");

        JavaFirstAttachmentPolicyService svc = ctx.getBean("JavaFirstAttachmentPolicyServiceClient",
                                                           JavaFirstAttachmentPolicyService.class);

        WSS4JOutInterceptor wssOut = addToClient(svc);

        // just some basic sanity tests first to make sure that auth is working where password is provided.
        wssOut.setProperties(getPasswordProperties("alice", "password"));
        svc.doInputMessagePolicy();

        wssOut.setProperties(getPasswordProperties("alice", "passwordX"));
        try {
            svc.doInputMessagePolicy();
            fail("Expected authentication failure");
        } catch (Exception e) {
            assertTrue(true);
        }

        wssOut.setProperties(getNoPasswordProperties("alice"));

        try {
            svc.doInputMessagePolicy();
            fail("Expected authentication failure");
        } catch (Exception e) {
View Full Code Here

Examples of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

            "org/apache/cxf/systest/ws/policy/client/javafirstclient.xml");

        SslUsernamePasswordAttachmentService svc = ctx.getBean("SslUsernamePasswordAttachmentServiceClient",
                                                               SslUsernamePasswordAttachmentService.class);

        WSS4JOutInterceptor wssOut = addToClient(svc);

        // just some basic sanity tests first to make sure that auth is working where password is provided.
        wssOut.setProperties(getPasswordProperties("alice", "password"));
        svc.doSslAndUsernamePasswordPolicy();

        wssOut.setProperties(getPasswordProperties("alice", "passwordX"));
        try {
            svc.doSslAndUsernamePasswordPolicy();
            fail("Expected authentication failure");
        } catch (Exception e) {
            assertTrue(true);
        }

        wssOut.setProperties(getNoPasswordProperties("alice"));

        try {
            svc.doSslAndUsernamePasswordPolicy();
            fail("Expected authentication failure");
        } catch (Exception e) {
View Full Code Here

Examples of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.doStuff();
            fail("Expected exception as no password and no client cert");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.doStuff();
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        simpleService.doStuff();

        wssOut.setProperties(getPasswordProperties("alice", "password"));

        // this is successful because the alternative policy allows a password to be specified.
        simpleService.doStuff();
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.doStuff();
            fail("Expected exception as no password and no client cert");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        try {
            simpleService.doStuff();
            fail("Expected exception as no client cert and password not allowed");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.ping();
            fail("Expected exception as no password");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.ping();
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        simpleService.doStuff();

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        try {
            simpleService.doStuff();
            fail("Expected exception as password not allowed");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.ping();
            fail("Expected exception as no password");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.ping();
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.doStuff();
            fail("Expected exception as no password and no client cert");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        // this is successful because the alternative policy allows a password to be specified.
        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.doStuff();
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        simpleService.doStuff();

        // this is successful because the alternative policy allows a password to be specified.
        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.doStuff();
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

        simpleService.doStuff();
    }

    private WSS4JOutInterceptor addToClient(Object svc) {
        Client client = ClientProxy.getClient(svc);
        WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor();
        client.getEndpoint().getOutInterceptors().add(wssOut);
        client.getOutInterceptors().add(wssOut);
        return wssOut;
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

        outProps.put("passwordType", "PasswordDigest");
        outProps.put("user", "charles");
        outProps.put("passwordCallbackClass", "org.apache.camel.example.reportincident.UTPasswordCallback");

        WSS4JOutInterceptor wss4j = new WSS4JOutInterceptor(outProps);

        // Add LoggingOutInterceptor
        LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();

        outInterceptors.add(wss4j);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.