Package javax.xml.ws

Examples of javax.xml.ws.BindingProvider


        doubleIt(bearerPort, 25);
       
        // Change the STSClient so that it can no longer find the STS
        STSClient stsClient = new STSClient(bus);
        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
        BindingProvider p = (BindingProvider)bearerPort;
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
       
        // This invocation should be successful as the token is cached
        doubleIt(bearerPort, 25);
       
        //
        // Proxy no. 2
        //
        DoubleItPortType bearerPort2 =
            service.getPort(portQName, DoubleItPortType.class);
        updateAddressPort(bearerPort2, PORT);
        if (standalone) {
            TokenTestUtils.updateSTSPort((BindingProvider)bearerPort2, STSPORT2);
        }
       
        // Change the STSClient so that it can no longer find the STS
        stsClient = new STSClient(bus);
        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
        p = (BindingProvider)bearerPort2;
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
       
        // This should fail as the cache is not being used
        try {
            doubleIt(bearerPort2, 40);
            fail("Failure expected as the token is not stored in the cache");
        } catch (Exception ex) {
            // expected
        }
       
        // Set the cache correctly
        p.getRequestContext().put(TokenStore.class.getName(), tokenStore);
       
        // Make another invocation - this should succeed as the token is cached
        p.getRequestContext().put("ws-security.username", "alice");
        doubleIt(bearerPort2, 40);
       
        // Reset the cache - this invocation should fail
        p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
        try {
            doubleIt(bearerPort2, 40);
            fail("Failure expected as the cache is reset");
        } catch (Exception ex) {
            // expected
View Full Code Here


        }
       
        // Change the STSClient so that it can no longer find the STS
        STSClient stsClient = new STSClient(bus);
        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
        BindingProvider p = (BindingProvider)bearerPort;
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
       
        // Make a successful invocation
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        doubleIt(bearerPort, 25);
       
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "bob"
        );
        doubleIt(bearerPort, 30);
       
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "eve2"
        );
        try {
            doubleIt(bearerPort, 30);
            fail("Failure expected on a bad user");
        } catch (Exception ex) {
            //
        }
       
        // Reset the cache - this invocation should fail
        p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        try {
            doubleIt(bearerPort, 30);
View Full Code Here

       
        // Make a successful invocation
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        BindingProvider p = (BindingProvider)bearerPort;
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
        );
        doubleIt(bearerPort, 25);
       
        // Make a successful invocation
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "bob"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        doubleIt(bearerPort, 25);
       
        // Change the STSClient so that it can no longer find the STS
        STSClient stsClient = new STSClient(bus);
        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
       
        // Make a successful invocation - should work as token is cached
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
        );
        doubleIt(bearerPort, 25);
       
        // Make a successful invocation - should work as token is cached
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "bob"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        doubleIt(bearerPort, 25);
       
        // Change appliesTo - should fail
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        try {
            doubleIt(bearerPort, 30);
View Full Code Here

        // Make a successful invocation
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        // Disable appliesTo
        BindingProvider p = (BindingProvider)bearerPort;
        STSClient stsClient = (STSClient)p.getRequestContext().get(SecurityConstants.STS_CLIENT);
        stsClient.setEnableAppliesTo(false);
        doubleIt(bearerPort, 25);
       
        // Change the STSClient so that it can no longer find the STS
        stsClient = new STSClient(bus);
        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
        stsClient.setEnableAppliesTo(false);
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
       
        // This should work
        doubleIt(bearerPort, 25);
       
        // Bob should fail
View Full Code Here

        doubleIt(bearerPort, 25);
       
        // Change the STSClient so that it can no longer find the STS
        STSClient stsClient = new STSClient(bus);
        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
        BindingProvider p = (BindingProvider)bearerPort;
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
       
        // This invocation should be successful as the token is cached
        doubleIt(bearerPort, 25);
       
        //
        // Proxy no. 2
        //
        DoubleItPortType bearerPort2 =
            service.getPort(portQName, DoubleItPortType.class);
        updateAddressPort(bearerPort2, PORT);
        if (standalone) {
            TokenTestUtils.updateSTSPort((BindingProvider)bearerPort2, STSPORT2);
        }
       
        // Change the STSClient so that it can no longer find the STS
        stsClient = new STSClient(bus);
        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
        p = (BindingProvider)bearerPort2;
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
       
        // This should fail as the cache is not being used
        try {
            doubleIt(bearerPort2, 40);
            fail("Failure expected as the token is not stored in the cache");
        } catch (Exception ex) {
            // expected
        }
       
        // Set the cache correctly
        p.getRequestContext().put(TokenStore.class.getName(), tokenStore);
       
        // Make another invocation - this should succeed as the token is cached
        p.getRequestContext().put("ws-security.username", "alice");
        doubleIt(bearerPort2, 40);
       
        // Reset the cache - this invocation should fail
        p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
        try {
            doubleIt(bearerPort2, 40);
            fail("Failure expected as the cache is reset");
        } catch (Exception ex) {
            // expected
View Full Code Here

        }
       
        // Change the STSClient so that it can no longer find the STS
        STSClient stsClient = new STSClient(bus);
        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
        BindingProvider p = (BindingProvider)bearerPort;
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
       
        // Make a successful invocation
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        doubleIt(bearerPort, 25);
       
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "bob"
        );
        doubleIt(bearerPort, 30);
       
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "eve2"
        );
        try {
            doubleIt(bearerPort, 30);
            fail("Failure expected on a bad user");
        } catch (Exception ex) {
            //
        }
       
        // Reset the cache - this invocation should fail
        p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        try {
            doubleIt(bearerPort, 30);
View Full Code Here

       
        // Make a successful invocation
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        BindingProvider p = (BindingProvider)bearerPort;
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
        );
        doubleIt(bearerPort, 25);
       
        // Make a successful invocation
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "bob"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        doubleIt(bearerPort, 25);
       
        // Change the STSClient so that it can no longer find the STS
        STSClient stsClient = new STSClient(bus);
        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
       
        // Make a successful invocation - should work as token is cached
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
        );
        doubleIt(bearerPort, 25);
       
        // Make a successful invocation - should work as token is cached
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "bob"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        doubleIt(bearerPort, 25);
       
        // Change appliesTo - should fail
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        try {
            doubleIt(bearerPort, 30);
View Full Code Here

        // Make a successful invocation
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        // Disable appliesTo
        BindingProvider p = (BindingProvider)bearerPort;
        STSClient stsClient = (STSClient)p.getRequestContext().get(SecurityConstants.STS_CLIENT);
        stsClient.setEnableAppliesTo(false);
        doubleIt(bearerPort, 25);
       
        // Change the STSClient so that it can no longer find the STS
        stsClient = new STSClient(bus);
        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
        stsClient.setEnableAppliesTo(false);
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
       
        // This should work
        doubleIt(bearerPort, 25);
       
        // Bob should fail
View Full Code Here

       
        // Make a successful invocation
        doubleIt(transportSaml1Port, 25);
       
        // Change the STSClient so that it can no longer find the STS
        BindingProvider p = (BindingProvider)transportSaml1Port;
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, new STSClient(bus));
       
        // This should succeed as the token is cached
        doubleIt(transportSaml1Port, 30);
       
        // This should fail as the cached token is manually removed
View Full Code Here

       
        // Make a successful invocation
        doubleIt(transportSaml1Port, 25);
       
        // Change the STSClient so that it can no longer find the STS
        BindingProvider p = (BindingProvider)transportSaml1Port;
        p.getRequestContext().put(SecurityConstants.STS_CLIENT, new STSClient(bus));
       
        // This should fail as it can't get the token
        try {
            doubleIt(transportSaml1Port, 35);
            fail("Expected failure");
View Full Code Here

TOP

Related Classes of javax.xml.ws.BindingProvider

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.