Package org.apache.pulsar.client.api
Interface Authentication
- All Superinterfaces:
AutoCloseable
,Closeable
,Serializable
Interface of authentication providers.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
authenticationStage
(String requestUrl, AuthenticationDataProvider authData, Map<String, String> previousResHeaders, CompletableFuture<Map<String, String>> authFuture) An authentication Stage.void
Deprecated.This method will be deleted on version 2.0, instead please use configure(String encodedAuthParamString) which is in EncodedAuthenticationParameterSupport for now and will be integrated into this interface.default AuthenticationDataProvider
default AuthenticationDataProvider
getAuthData
(String brokerHostName) Get/Create an authentication data provider which provides the data that this client will be sent to the broker.newRequestHeader
(String hostName, AuthenticationDataProvider authData, Map<String, String> previousResHeaders) Add an authenticationStage that will complete along with authFuture.void
start()
Initialize the authentication provider.
-
Method Details
-
getAuthMethodName
String getAuthMethodName()- Returns:
- the identifier for this authentication method
-
getAuthData
- Returns:
- The authentication data identifying this client that will be sent to the broker
- Throws:
PulsarClientException.GettingAuthenticationDataException
- if there was error getting the authentication data to usePulsarClientException
- any other error
-
getAuthData
Get/Create an authentication data provider which provides the data that this client will be sent to the broker. Some authentication method need to auth between each client channel. So it need the broker, who it will talk to.- Parameters:
brokerHostName
- target broker host name- Returns:
- The authentication data provider
- Throws:
PulsarClientException
-
configure
Deprecated.This method will be deleted on version 2.0, instead please use configure(String encodedAuthParamString) which is in EncodedAuthenticationParameterSupport for now and will be integrated into this interface.Configure the authentication plugins with the supplied parameters.- Parameters:
authParams
-
-
start
Initialize the authentication provider.- Throws:
PulsarClientException
-
authenticationStage
default void authenticationStage(String requestUrl, AuthenticationDataProvider authData, Map<String, String> previousResHeaders, CompletableFuture<Map<String, String>> authFuture) An authentication Stage. when authentication complete, passed-in authFuture will contains authentication related http request headers. -
newRequestHeader
default Set<Map.Entry<String,String>> newRequestHeader(String hostName, AuthenticationDataProvider authData, Map<String, String> previousResHeaders) throws ExceptionAdd an authenticationStage that will complete along with authFuture.- Throws:
Exception
-