use of org.apache.cxf.BusException in project OpenAM by OpenRock.
the class SoapSTSConsumer method handleSTSServerCertCNDNSMismatch.
/**
* This method must be called in case the CN in the Certificate presented by the container hosting the published sts
* instance does not match the DNS name of this server. This check should not be relied-upon in production, and is
* only present to facilitate testing.
* @param stsClient The stsClient which will make the sts invocations
*/
private void handleSTSServerCertCNDNSMismatch(STSClient stsClient) throws SoapSTSConsumerException {
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
return true;
}
});
/*
CXF client also needs to have disabled the CN check in server-presented cert for TLS cases, if cert CN
does not match DNS
*/
TLSClientParameters tlsClientParameters = new TLSClientParameters();
tlsClientParameters.setDisableCNCheck(true);
try {
((HTTPConduit) stsClient.getClient().getConduit()).setTlsClientParameters(tlsClientParameters);
} catch (BusException | EndpointException e) {
throw new SoapSTSConsumerException(e.getMessage(), e);
}
}
use of org.apache.cxf.BusException in project camel by apache.
the class CamelTransportFactory method unregisterFactory.
public final void unregisterFactory() {
if (null == bus) {
return;
}
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
if (null != dfm && getTransportIds() != null) {
for (String ns : getTransportIds()) {
try {
if (dfm.getDestinationFactory(ns) == this) {
dfm.deregisterDestinationFactory(ns);
}
} catch (BusException e) {
//ignore
}
}
}
ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
if (cim != null && getTransportIds() != null) {
for (String ns : getTransportIds()) {
try {
if (cim.getConduitInitiator(ns) == this) {
cim.deregisterConduitInitiator(ns);
}
} catch (BusException e) {
//ignore
}
}
}
}
use of org.apache.cxf.BusException in project cxf by apache.
the class SpringBusFactoryTest method checkTransportFactories.
private void checkTransportFactories(Bus bus) throws BusException {
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
assertNotNull("No destination factory manager", dfm);
ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
assertNotNull("No conduit initiator manager", cim);
try {
cim.getConduitInitiator("http://cxf.apache.org/unknown");
} catch (BusException ex) {
// expected
}
try {
dfm.getDestinationFactory("http://cxf.apache.org/unknown");
} catch (BusException ex) {
// expected
}
// not sure that we need this - Dan Diephouse
// assertNotNull("conduit initiator not available",
// cim.getConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/"));
assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/http"));
assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/jms"));
assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/jms/configuration"));
assertNotNull("destination factory not available", dfm.getDestinationFactory("http://cxf.apache.org/transports/http"));
assertNotNull("destination factory not available", dfm.getDestinationFactory("http://cxf.apache.org/transports/jms"));
assertNotNull("destination factory not available", dfm.getDestinationFactory("http://cxf.apache.org/transports/jms/configuration"));
}
use of org.apache.cxf.BusException in project cxf by apache.
the class SpringBusFactoryTest method checkBindingExtensions.
private void checkBindingExtensions(Bus bus) throws BusException {
BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
assertNotNull("No binding factory manager", bfm);
assertNotNull("binding factory not available", bfm.getBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/"));
try {
bfm.getBindingFactory("http://cxf.apache.org/unknown");
} catch (BusException ex) {
// expected
}
}
use of org.apache.cxf.BusException in project cxf by apache.
the class AbstractConduitSelector method getSelectedConduit.
/**
* Mechanics to actually get the Conduit from the ConduitInitiator
* if necessary.
*
* @param message the current Message
*/
protected Conduit getSelectedConduit(Message message) {
Conduit c = findCompatibleConduit(message);
if (c == null) {
Exchange exchange = message.getExchange();
EndpointInfo ei = endpoint.getEndpointInfo();
String transportID = ei.getTransportId();
try {
ConduitInitiatorManager conduitInitiatorMgr = exchange.getBus().getExtension(ConduitInitiatorManager.class);
if (conduitInitiatorMgr != null) {
ConduitInitiator conduitInitiator = conduitInitiatorMgr.getConduitInitiator(transportID);
if (conduitInitiator != null) {
c = createConduit(message, exchange, conduitInitiator);
} else {
getLogger().warning("ConduitInitiator not found: " + ei.getAddress());
}
} else {
getLogger().warning("ConduitInitiatorManager not found");
}
} catch (BusException ex) {
throw new Fault(ex);
} catch (IOException ex) {
throw new Fault(ex);
}
}
if (c != null && c.getTarget() != null && c.getTarget().getAddress() != null) {
replaceEndpointAddressPropertyIfNeeded(message, c.getTarget().getAddress().getValue(), c);
}
// the search for the conduit could cause extra properties to be reset/loaded.
message.resetContextCache();
message.put(Conduit.class, c);
return c;
}
Aggregations