Java Code Examples for org.apache.cxf.ws.security.trust.STSUtils#createSTSEndpoint()

The following examples show how to use org.apache.cxf.ws.security.trust.STSUtils#createSTSEndpoint() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 2
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 3
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 4
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 5
Source File: NegotiationUtils.java    From cxf with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message,
    String namespace,
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = TokenStoreUtils.getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus,
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(),
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus,
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(),
                                                  policy,
                                                  null);
        }
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination, message);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors(message);
        message.getInterceptorChain().add(interceptors);

        Collection<Assertion> assertions = ep.getVocabulary(message);
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}