use of org.apache.qpid.proton.engine.SslDomain in project azure-service-bus-java by Azure.
the class ConnectionHandler method onConnectionBound.
@Override
public void onConnectionBound(Event event) {
TRACE_LOGGER.debug("onConnectionBound: hostname:{}", event.getConnection().getHostname());
Transport transport = event.getTransport();
SslDomain domain = makeDomain(SslDomain.Mode.CLIENT);
transport.ssl(domain);
Sasl sasl = transport.sasl();
sasl.setMechanisms("ANONYMOUS");
}
use of org.apache.qpid.proton.engine.SslDomain in project azure-service-bus-java by Azure.
the class ConnectionHandler method makeDomain.
private static SslDomain makeDomain(SslDomain.Mode mode) {
SslDomain domain = Proton.sslDomain();
domain.init(mode);
// TODO: VERIFY_PEER_NAME support
domain.setPeerAuthentication(SslDomain.VerifyMode.ANONYMOUS_PEER);
return domain;
}
use of org.apache.qpid.proton.engine.SslDomain in project azure-iot-sdk-java by Azure.
the class AmqpConnectionHandler method onConnectionBound.
/**
* Event handler for the connection bound event
* @param event The proton event object
*/
@Override
public void onConnectionBound(Event event) {
Transport transport = event.getConnection().getTransport();
if (transport != null) {
if (this.iotHubServiceClientProtocol == IotHubServiceClientProtocol.AMQPS_WS) {
WebSocketImpl webSocket = new WebSocketImpl(MAX_MESSAGE_PAYLOAD_SIZE);
webSocket.configure(this.hostName, WEB_SOCKET_PATH, WEB_SOCKET_QUERY, AMQPS_WS_PORT, WEB_SOCKET_SUB_PROTOCOL, null, null);
((TransportInternal) transport).addTransportLayer(webSocket);
}
// Note that this does not mean that the connection will not be authenticated. This simply defers authentication
// to the claims based security model that IoT Hub implements wherein the client sends the authentication token
// over the CBS link rather than doing a sasl.plain(username, password) call at this point.
transport.sasl().setMechanisms("ANONYMOUS");
SslDomain domain = makeDomain();
domain.setPeerAuthentication(SslDomain.VerifyMode.VERIFY_PEER);
transport.ssl(domain);
if (this.proxyOptions != null) {
addProxyLayer(transport, this.hostName);
}
}
}
use of org.apache.qpid.proton.engine.SslDomain in project azure-iot-sdk-java by Azure.
the class AmqpConnectionHandler method makeDomain.
/**
* Create Proton SslDomain object from Address using the given Ssl mode
* @return The created Ssl domain
*/
private SslDomain makeDomain() {
SslDomain domain = Proton.sslDomain();
try {
if (this.sslContext == null) {
// Need the base trusted certs for IotHub in our ssl context. IotHubSSLContext handles that
domain.setSslContext(new IotHubSSLContext().getSSLContext());
} else {
// Custom SSLContext set by user from service client options
domain.setSslContext(this.sslContext);
}
} catch (Exception e) {
this.savedException = e;
}
domain.init(SslDomain.Mode.CLIENT);
return domain;
}
Aggregations