org.apache.qpid.proton.engine.Transport.sasl()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中org.apache.qpid.proton.engine.Transport.sasl()方法的一些代码示例,展示了Transport.sasl()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transport.sasl()方法的具体详情如下:
包路径:org.apache.qpid.proton.engine.Transport
类名称:Transport
方法名:sasl

Transport.sasl介绍

[英]Signal the transport to expect SASL frames used to establish a SASL layer prior to performing the AMQP protocol version negotiation. This must first be performed before the transport is used for processing. Subsequent invocations will return the same Sasl object.
[中]在执行AMQP协议版本协商之前,向传输发送信号,使其预期用于建立SASL层的SASL帧。在使用传输进行处理之前,必须首先执行此操作。后续调用将返回相同的Sasl对象。

代码示例

代码示例来源:origin: org.apache.qpid/proton

public Sasl sasl()
{
  if (_transport != null)
  {
    return _transport.sasl();
  }
  else
  {
    return null;
  }
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

public Sasl sasl()
{
  if (_transport != null)
  {
    return _transport.sasl();
  }
  else
  {
    return null;
  }
}

代码示例来源:origin: org.apache.qpid/proton-j-impl

public Sasl sasl()
{
  if (_transport != null)
  {
    return _transport.sasl();
  }
  else
  {
    return null;
  }
}

代码示例来源:origin: io.vertx/vertx-proton

@Override
public void init(NetSocket socket, ProtonConnection protonConnection, Transport transport) {
 this.socket = socket;
 this.connection = protonConnection;
 this.sasl = transport.sasl();
 sasl.client();
}

代码示例来源:origin: apache/activemq-artemis

public void createClientSASL() {
 Sasl sasl = transport.sasl();
 sasl.client();
 sasl.setListener(this);
}

代码示例来源:origin: org.apache.activemq/artemis-amqp-protocol

public void createClientSASL() {
 Sasl sasl = transport.sasl();
 sasl.client();
 sasl.setListener(this);
}

代码示例来源:origin: org.apache.activemq/artemis-proton-plug

@Override
public void createServerSASL(ServerSASL[] handlers) {
 this.serverSasl = transport.sasl();
 saslHandlers = new HashMap<>();
 String[] names = new String[handlers.length];
 int count = 0;
 for (ServerSASL handler : handlers) {
   saslHandlers.put(handler.getName(), handler);
   names[count++] = handler.getName();
 }
 this.serverSasl.server();
 serverSasl.setMechanisms(names);
}

代码示例来源:origin: org.apache.activemq/artemis-amqp-protocol

public void createServerSASL(String[] mechanisms) {
 Sasl sasl = transport.sasl();
 sasl.server();
 sasl.setMechanisms(mechanisms);
 sasl.setListener(this);
}

代码示例来源:origin: io.vertx/vertx-proton

@Override
public void init(NetSocket socket, ProtonConnection protonConnection, Transport transport) {
 this.sasl = transport.sasl();
 sasl.server();
 sasl.allowSkip(false);
 sasl.setMechanisms(ProtonSaslAnonymousImpl.MECH_NAME);
 succeeded = false;
}

代码示例来源:origin: EnMasseProject/enmasse

private boolean isSaslAuthenticated(Connection connection, SaslMechanism mechanism) {
  Transport transport = connection.getTransport();
  Sasl sasl = transport.sasl();
  return sasl.getState() == PN_SASL_PASS && mechanism.completedSuccessfully();
}

代码示例来源:origin: eclipse/hono

@Override
public void init(final NetSocket socket, final ProtonConnection protonConnection, final Transport transport) {
  LOG.debug("initializing SASL authenticator");
  this.protonConnection = protonConnection;
  this.sasl = transport.sasl();
  sasl.server();
  sasl.allowSkip(false);
  sasl.setMechanisms(AuthenticationConstants.MECHANISM_PLAIN, AuthenticationConstants.MECHANISM_EXTERNAL);
  if (socket.isSsl()) {
    LOG.trace("Client connected through a secured port");
    try {
      peerCertificateChain = socket.sslSession().getPeerCertificates();
    } catch (SSLPeerUnverifiedException e) {
      LOG.debug("Device's Identity cannot be verified: " + e.getMessage());
    }
  }
}

代码示例来源:origin: org.eclipse.hono/hono-server

@Override
public void init(final NetSocket socket, final ProtonConnection protonConnection, final Transport transport) {
  LOG.debug("initializing SASL authenticator");
  this.protonConnection = protonConnection;
  this.sasl = transport.sasl();
  // TODO determine supported mechanisms dynamically based on registered AuthenticationService implementations
  sasl.server();
  sasl.allowSkip(false);
  sasl.setMechanisms(MECHANISM_EXTERNAL, MECHANISM_PLAIN);
  if (socket.isSsl()) {
    LOG.debug("client connected using TLS, extracting client certificate chain");
    try {
      peerCertificateChain = socket.peerCertificateChain();
      LOG.debug("found valid client certificate DN [{}]", peerCertificateChain[0].getSubjectDN());
    } catch (SSLPeerUnverifiedException e) {
      LOG.debug("could not extract client certificate chain, maybe TLS based client auth is not required");
    }
  }
}

代码示例来源:origin: org.eclipse.hono/hono-service-base

@Override
public void init(final NetSocket socket, final ProtonConnection protonConnection, final Transport transport) {
  LOG.debug("initializing SASL authenticator");
  this.protonConnection = protonConnection;
  this.sasl = transport.sasl();
  // TODO determine supported mechanisms dynamically based on registered AuthenticationService implementations
  sasl.server();
  sasl.allowSkip(false);
  sasl.setMechanisms(MECHANISM_EXTERNAL, MECHANISM_PLAIN);
  if (socket.isSsl()) {
    LOG.debug("client connected using TLS, extracting client certificate chain");
    try {
      peerCertificateChain = socket.peerCertificateChain();
      LOG.debug("found valid client certificate DN [{}]", peerCertificateChain[0].getSubjectDN());
    } catch (final SSLPeerUnverifiedException e) {
      LOG.debug("could not extract client certificate chain, maybe TLS based client auth is not required");
    }
  }
}

代码示例来源:origin: eclipse/hono

@Override
public void init(final NetSocket socket, final ProtonConnection protonConnection, final Transport transport) {
  LOG.debug("initializing SASL authenticator");
  this.protonConnection = protonConnection;
  this.sasl = transport.sasl();
  // TODO determine supported mechanisms dynamically based on registered AuthenticationService implementations
  sasl.server();
  sasl.allowSkip(false);
  sasl.setMechanisms(MECHANISM_EXTERNAL, MECHANISM_PLAIN);
  if (socket.isSsl()) {
    LOG.debug("client connected using TLS, extracting client certificate chain");
    try {
      peerCertificateChain = socket.peerCertificateChain();
      LOG.debug("found valid client certificate DN [{}]", peerCertificateChain[0].getSubjectDN());
    } catch (final SSLPeerUnverifiedException e) {
      LOG.debug("could not extract client certificate chain, maybe TLS based client auth is not required");
    }
  }
}

代码示例来源:origin: Azure/azure-service-bus-java

@Override
public void onConnectionBound(Event event)
{
  TRACE_LOGGER.debug("onConnectionBound: hostname:{}", event.getConnection().getHostname());
  Transport transport = event.getTransport();
  
  this.addTransportLayers(event, (TransportInternal) transport);
  Sasl sasl = transport.sasl();
  sasl.setMechanisms("ANONYMOUS");
}

代码示例来源:origin: org.apache.activemq/artemis-proton-plug

@Override
public void createClientSasl(ClientSASL clientSASL) {
 if (clientSASL != null) {
   clientSasl = transport.sasl();
   clientSasl.setMechanisms(clientSASL.getName());
   byte[] initialSasl = clientSASL.getBytes();
   clientSasl.send(initialSasl, 0, initialSasl.length);
 }
}

代码示例来源:origin: apache/activemq-artemis

public void createServerSASL(String[] mechanisms) {
 requireHandler();
 Sasl sasl = transport.sasl();
 sasl.server();
 sasl.setMechanisms(mechanisms);
 sasl.setListener(this);
}

代码示例来源:origin: Azure/azure-service-bus-java

@Override
public void onConnectionLocalOpen(Event event)
{
  Connection connection = event.getConnection();
  if (connection.getRemoteState() != EndpointState.UNINITIALIZED)
  {
    return;
  }
  Transport transport = Proton.transport();
  transport.sasl();
  transport.setEmitFlowEventOnSend(false);
  transport.bind(connection);
}

代码示例来源:origin: EnMasseProject/enmasse

@Override
public void init(final NetSocket socket,
         final ProtonConnection protonConnection,
         final Transport transport) {
  // allow for frames bigger than 512 bytes to support mechanisms that send (for instance) tokens
  transport.setInitialRemoteMaxFrameSize(1024*1024);
  this.sasl = transport.sasl();
  sasl.server();
  sasl.allowSkip(false);
  sasl.setMechanisms(getValidMechanisms(getPasswordHashAlgorithms()));
  connection = protonConnection;
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

private void handleOpen(Event event) {
  Connection connection = event.getConnection();
  if (connection.getRemoteState() != EndpointState.UNINITIALIZED) {
    return;
  }
  Transport transport = Proton.transport();
  Sasl sasl = transport.sasl();
  sasl.client();
  sasl.setMechanisms("ANONYMOUS");
  transport.webSocket();
  transport.bind(connection);
}

相关文章