Examples of MemoryTokenStore


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

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

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

        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,
                                                  endpoint.getEndpointInfo().getTransportId(),
View Full Code Here

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

   
   
    static final TokenStore getTokenStore(Message message) {
        TokenStore tokenStore = (TokenStore)message.getContextualProperty(TokenStore.class.getName());
        if (tokenStore == null) {
            tokenStore = new MemoryTokenStore();
            message.getExchange().get(Endpoint.class).getEndpointInfo()
                .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

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

            service.getPort(portQName, DoubleItPortType.class);
        updateAddressPort(port, PORT);
       
        TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
       
        TokenStore tokenStore = new MemoryTokenStore();
        ((BindingProvider)port).getRequestContext().put(
            TokenStore.class.getName(), tokenStore
        );

        // Make a successful invocation
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        doubleIt(port, 25);
       
        // Change the STSClient so that it can no longer find the STS
        BindingProvider p = (BindingProvider)port;
        clearSTSClient(p);
       
        // This invocation should be successful as the token is cached
        doubleIt(port, 25);
       
        ((java.io.Closeable)port).close();
        //
        // Proxy no. 2
        //
        DoubleItPortType port2 =
            service.getPort(portQName, DoubleItPortType.class);
        updateAddressPort(port2, PORT);
       
        TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
       
        // Change the STSClient so that it can no longer find the STS
        p = (BindingProvider)port2;
        clearSTSClient(p);
       
        // This should fail as the cache is not being used
        try {
            doubleIt(port2, 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(port2, 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(port2, 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)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        try {
            doubleIt(port, 30);
View Full Code Here

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

            service.getPort(portQName, DoubleItPortType.class);
        updateAddressPort(port, PORT);
       
        TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
       
        TokenStore tokenStore = new MemoryTokenStore();
        ((BindingProvider)port).getRequestContext().put(
            TokenStore.class.getName(), tokenStore
        );

        // Make a successful invocation
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        doubleIt(port, 25);
       
        // Change the STSClient so that it can no longer find the STS
        BindingProvider p = (BindingProvider)port;
        clearSTSClient(p);
       
        // This invocation should be successful as the token is cached
        doubleIt(port, 25);
       
        //
        // Proxy no. 2
        //
        DoubleItPortType port2 =
            service.getPort(portQName, DoubleItPortType.class);
        updateAddressPort(port2, PORT);
       
        TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
       
        // Change the STSClient so that it can no longer find the STS
        p = (BindingProvider)port2;
        clearSTSClient(p);
       
        // This should fail as the cache is not being used
        try {
            doubleIt(port2, 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(port2, 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(port2, 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)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        try {
            doubleIt(port, 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());

        SAMLCallback samlCallback = new SAMLCallback();
        SAMLUtil.doSAMLCallback(new Saml2CallbackHandler(), samlCallback);
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.