Package org.apache.pulsar.client.api
Interface Authentication
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,java.io.Serializable
@LimitedPrivate @Stable public interface Authentication extends java.io.Closeable, java.io.Serializable
Interface of authentication providers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default void
authenticationStage(java.lang.String requestUrl, AuthenticationDataProvider authData, java.util.Map<java.lang.String,java.lang.String> previousResHeaders, java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String>> authFuture)
An authentication Stage.void
configure(java.util.Map<java.lang.String,java.lang.String> authParams)
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
getAuthData()
default AuthenticationDataProvider
getAuthData(java.lang.String brokerHostName)
Get/Create an authentication data provider which provides the data that this client will be sent to the broker.java.lang.String
getAuthMethodName()
default java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>>
newRequestHeader(java.lang.String hostName, AuthenticationDataProvider authData, java.util.Map<java.lang.String,java.lang.String> previousResHeaders)
Add an authenticationStage that will complete along with authFuture.void
start()
Initialize the authentication provider.
-
-
-
Method Detail
-
getAuthMethodName
java.lang.String getAuthMethodName()
- Returns:
- the identifier for this authentication method
-
getAuthData
default AuthenticationDataProvider getAuthData() throws PulsarClientException
- 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
default AuthenticationDataProvider getAuthData(java.lang.String brokerHostName) throws PulsarClientException
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 void configure(java.util.Map<java.lang.String,java.lang.String> authParams)
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
void start() throws PulsarClientException
Initialize the authentication provider.- Throws:
PulsarClientException
-
authenticationStage
default void authenticationStage(java.lang.String requestUrl, AuthenticationDataProvider authData, java.util.Map<java.lang.String,java.lang.String> previousResHeaders, java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String>> authFuture)
An authentication Stage. when authentication complete, passed-in authFuture will contains authentication related http request headers.
-
newRequestHeader
default java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> newRequestHeader(java.lang.String hostName, AuthenticationDataProvider authData, java.util.Map<java.lang.String,java.lang.String> previousResHeaders) throws java.lang.Exception
Add an authenticationStage that will complete along with authFuture.- Throws:
java.lang.Exception
-
-