@ThreadSafe public final class PlainSaslTransportProvider extends Object implements TransportProvider
AuthType.SIMPLE
or AuthType.CUSTOM
, this is the
default transport provider which uses SASL transport.TransportProvider.Factory
Constructor and Description |
---|
PlainSaslTransportProvider()
Constructor for transport provider with
AuthType.SIMPLE or AuthType.CUSTOM . |
Modifier and Type | Method and Description |
---|---|
org.apache.thrift.transport.TTransport |
getClientTransport(InetSocketAddress serverAddress)
Creates a transport per the connection options.
|
org.apache.thrift.transport.TTransport |
getClientTransport(String username,
String password,
String impersonationUser,
InetSocketAddress serverAddress)
Gets a PLAIN mechanism transport for client side.
|
org.apache.thrift.transport.TTransport |
getClientTransport(Subject subject,
InetSocketAddress serverAddress)
Similar as
TransportProvider.getClientTransport(InetSocketAddress) but it also
specifies the Subject explicitly. |
org.apache.thrift.transport.TTransportFactory |
getServerTransportFactory(Runnable runnable,
String serverName)
For server side, this method returns a
TTransportFactory based on the auth type. |
org.apache.thrift.transport.TTransportFactory |
getServerTransportFactory(String serverName)
For server side, this method returns a
TTransportFactory based on the auth type. |
public PlainSaslTransportProvider()
AuthType.SIMPLE
or AuthType.CUSTOM
.public org.apache.thrift.transport.TTransport getClientTransport(InetSocketAddress serverAddress) throws UnauthenticatedException
TransportProvider
AuthType.NOSASL
, AuthType.SIMPLE
, {link@ AuthType#CUSTOM},
AuthType.KERBEROS
. With NOSASL as input, an unmodified TTransport
is returned;
with SIMPLE/CUSTOM as input, a PlainClientTransport is returned; KERBEROS is not supported
currently. If the auth type is not supported or recognized, an
UnsupportedOperationException
is thrown.getClientTransport
in interface TransportProvider
serverAddress
- the server address which clients will connect toUnauthenticatedException
public org.apache.thrift.transport.TTransport getClientTransport(Subject subject, InetSocketAddress serverAddress) throws UnauthenticatedException
TransportProvider
TransportProvider.getClientTransport(InetSocketAddress)
but it also
specifies the Subject
explicitly.getClientTransport
in interface TransportProvider
subject
- the subject, set to null if not presentserverAddress
- the server address which clients will connect toUnauthenticatedException
public org.apache.thrift.transport.TTransport getClientTransport(String username, String password, String impersonationUser, InetSocketAddress serverAddress) throws UnauthenticatedException
username
- User Name of PlainClientpassword
- Password of PlainClientimpersonationUser
- impersonation user (not used if null)serverAddress
- address of the serverUnauthenticatedException
public org.apache.thrift.transport.TTransportFactory getServerTransportFactory(String serverName) throws SaslException
TransportProvider
TTransportFactory
based on the auth type. It is
used as one argument to build a Thrift TServer
. If the auth
type is not supported or recognized, an UnsupportedOperationException
is thrown.getServerTransportFactory
in interface TransportProvider
serverName
- the name for this serverSaslException
- if building a TransportFactory failspublic org.apache.thrift.transport.TTransportFactory getServerTransportFactory(Runnable runnable, String serverName) throws SaslException
TransportProvider
TTransportFactory
based on the auth type. It is
used as one argument to build a Thrift TServer
. If the auth
type is not supported or recognized, an UnsupportedOperationException
is thrown.getServerTransportFactory
in interface TransportProvider
runnable
- a closure to run after the transport is establishedserverName
- the name for this serverSaslException
- if building a TransportFactory failsCopyright © 2023. All Rights Reserved.