if (null == pe) {
return;
}
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,
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<PolicyAssertion> assertions = ep.getVocabulary();
if (null != assertions) {
message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
}
endpoint.getService().setInvoker(new STSInvoker());
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);
}