org.apache.thrift.transport.TSaslClientTransport Java Examples

The following examples show how to use org.apache.thrift.transport.TSaslClientTransport. 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: ThriftUtil.java    From incubator-sentry with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the underlying TSocket from the transport, or null of the transport type is unknown.
 */
private static TSocket getUnderlyingSocketFromTransport(TTransport transport) {
  Preconditions.checkNotNull(transport);
  if (transport instanceof TSaslServerTransport) {
    return (TSocket) ((TSaslServerTransport) transport).getUnderlyingTransport();
  } else if (transport instanceof TSaslClientTransport) {
    return (TSocket) ((TSaslClientTransport) transport).getUnderlyingTransport();
  } else if (transport instanceof TSocket) {
    return (TSocket) transport;
  }
  return null;
}
 
Example #2
Source File: DigestSaslTransportPlugin.java    From jstorm with Apache License 2.0 5 votes vote down vote up
@Override
public TTransport connect(TTransport transport, String serverHost, String asUser) throws TTransportException, IOException {
    ClientCallbackHandler client_callback_handler = new ClientCallbackHandler(login_conf);
    TSaslClientTransport wrapper_transport =
            new TSaslClientTransport(DIGEST, null, AuthUtils.SERVICE, serverHost, null, client_callback_handler, transport);

    wrapper_transport.open();
    LOG.debug("SASL DIGEST-MD5 client transport has been established");

    return wrapper_transport;
}