Examples of MemoryTokenStore


Examples of org.apache.cxf.ws.security.tokenstore.MemoryTokenStore

        Destination destination = ex.getDestination();
        try {
            Endpoint endpoint = message.getExchange().get(Endpoint.class);
            TokenStore store = (TokenStore)message.getContextualProperty(TokenStore.class.getName());
            if (store == null) {
                store = new MemoryTokenStore();
                endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
            }
            endpoint = STSUtils.createSTSEndpoint(bus,
                                                  namespace,
                                                  null,
View Full Code Here

Examples of org.apache.cxf.ws.security.tokenstore.MemoryTokenStore

            TokenStore tokenStore = (TokenStore)message.getContextualProperty(TokenStore.class.getName());
            if (tokenStore == null) {
                tokenStore = (TokenStore)info.getProperty(TokenStore.class.getName());
            }
            if (tokenStore == null) {
                tokenStore = new MemoryTokenStore();
                info.setProperty(TokenStore.class.getName(), tokenStore);
            }
            return tokenStore;
        }
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.tokenstore.MemoryTokenStore

            TokenStore tokenStore = (TokenStore)message.getContextualProperty(TokenStore.class.getName());
            if (tokenStore == null) {
                tokenStore = (TokenStore)info.getProperty(TokenStore.class.getName());
            }
            if (tokenStore == null) {
                tokenStore = new MemoryTokenStore();
                info.setProperty(TokenStore.class.getName(), tokenStore);
            }
            return tokenStore;
        }
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.tokenstore.MemoryTokenStore

        updateAddressPort(bearerPort, PORT);
        if (standalone) {
            TokenTestUtils.updateSTSPort((BindingProvider)bearerPort, STSPORT2);
        }
       
        TokenStore tokenStore = new MemoryTokenStore();
        ((BindingProvider)bearerPort).getRequestContext().put(
            TokenStore.class.getName(), tokenStore
        );

        // Make a successful invocation
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        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());
        p.getRequestContext().put(SecurityConstants.TOKEN, new SecurityToken());
        try {
            doubleIt(bearerPort2, 40);
            fail("Failure expected as the cache is reset");
        } catch (Exception ex) {
View Full Code Here

Examples of org.apache.cxf.ws.security.tokenstore.MemoryTokenStore

        } 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

Examples of org.apache.cxf.ws.security.tokenstore.MemoryTokenStore

        // IssuedTokenInterceptorProvider does not invoke on the STS
        //
        Client client = ClientProxy.getClient(transportSaml2Port);
        Endpoint ep = client.getEndpoint();
        String id = "1234";
        ep.getEndpointInfo().setProperty(TokenStore.class.getName(), new MemoryTokenStore());
        ep.getEndpointInfo().setProperty(SecurityConstants.TOKEN_ID, id);
        TokenStore store = (TokenStore)ep.getEndpointInfo().getProperty(TokenStore.class.getName());

        SAMLParms samlParms = new SAMLParms();
        samlParms.setCallbackHandler(new Saml2CallbackHandler());
View Full Code Here

Examples of org.apache.cxf.ws.security.tokenstore.MemoryTokenStore

        updateAddressPort(bearerPort, PORT);
        if (standalone) {
            TokenTestUtils.updateSTSPort((BindingProvider)bearerPort, STSPORT2);
        }
       
        TokenStore tokenStore = new MemoryTokenStore();
        ((BindingProvider)bearerPort).getRequestContext().put(
            TokenStore.class.getName(), tokenStore
        );

        // Make a successful invocation
        ((BindingProvider)bearerPort).getRequestContext().put(
            "ws-security.username", "alice"
        );
        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());
        p.getRequestContext().put(SecurityConstants.TOKEN, new SecurityToken());
        try {
            doubleIt(bearerPort2, 40);
            fail("Failure expected as the cache is reset");
        } catch (Exception ex) {
View Full Code Here

Examples of org.apache.cxf.ws.security.tokenstore.MemoryTokenStore

        } 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

Examples of org.apache.cxf.ws.security.tokenstore.MemoryTokenStore

            TokenStore tokenStore = (TokenStore)message.getContextualProperty(TokenStore.class.getName());
            if (tokenStore == null) {
                tokenStore = (TokenStore)info.getProperty(TokenStore.class.getName());
            }
            if (tokenStore == null) {
                tokenStore = new MemoryTokenStore();
                info.setProperty(TokenStore.class.getName(), tokenStore);
            }
            return tokenStore;
        }
    }
View Full Code Here

Examples of org.apache.cxf.ws.security.tokenstore.MemoryTokenStore

       
        msg.getExchange().get(Endpoint.class).put(SecurityConstants.TOKEN_ID,
                issuedToken.getId());
        msg.getExchange().put(SecurityConstants.TOKEN_ID, issuedToken.getId());
       
        TokenStore tokenStore = new MemoryTokenStore();
        msg.getExchange().get(Endpoint.class).getEndpointInfo()
            .setProperty(TokenStore.class.getName(), tokenStore);
        tokenStore.add(issuedToken);
       
        // fire the interceptor and verify results
        final Document signedDoc = this.runOutInterceptorAndValidate(
                msg, policy, aim, null, null);
       
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.