Package org.apache.cxf.ws.security.wss4j

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


        Client client = ClientProxy.getClient(greeter);
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("action", "UsernameToken");
        props.put("user", "alice");
        props.put("passwordType", "PasswordText");
        WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor(props);
       
        client.getOutInterceptors().add(wss4jOut);

        ((BindingProvider)greeter).getRequestContext().put("password", "password");
       
View Full Code Here

        Client client = ClientProxy.getClient(greeter);
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("action", "UsernameToken");
        props.put("user", "alice");
        props.put("passwordType", "PasswordText");
        WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor(props);
       
        client.getOutInterceptors().add(wss4jOut);

        ((BindingProvider)greeter).getRequestContext().put("password", "password");
       
View Full Code Here

            "org/apache/cxf/systest/ws/policy/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

            "org/apache/cxf/systest/ws/policy/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

            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();
       
        clientContext.close();
    }
View Full Code Here

            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();
       
        clientContext.close();
View Full Code Here

            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();
       
        clientContext.close();
    }
View Full Code Here

            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();
       
        clientContext.close();
    }
View Full Code Here

            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();
       
        clientContext.close();
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor

Copyright © 2018 www.massapicom. 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.