Package org.apache.pulsar.client.api
Class AuthenticationFactory
- java.lang.Object
-
- org.apache.pulsar.client.api.AuthenticationFactory
-
@LimitedPrivate @Stable public final class AuthenticationFactory extends java.lang.Object
Factory class that allows to createAuthenticationinstances for all the supported authentication methods.
-
-
Constructor Summary
Constructors Constructor Description AuthenticationFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Authenticationcreate(java.lang.String authPluginClassName, java.lang.String authParamsString)Create an instance of theAuthenticationobject by using the plugin class name.static Authenticationcreate(java.lang.String authPluginClassName, java.util.Map<java.lang.String,java.lang.String> authParams)Create an instance of the Authentication-Plugin.static AuthenticationTLS(java.lang.String certFilePath, java.lang.String keyFilePath)Create an authentication provider for TLS based authentication.static Authenticationtoken(java.lang.String token)Create an authentication provider for token based authentication.static Authenticationtoken(java.util.function.Supplier<java.lang.String> tokenSupplier)Create an authentication provider for token based authentication.
-
-
-
Method Detail
-
token
public static Authentication token(java.lang.String token)
Create an authentication provider for token based authentication.- Parameters:
token- the client auth token- Returns:
- the Authentication object initialized with the token credentials
-
token
public static Authentication token(java.util.function.Supplier<java.lang.String> tokenSupplier)
Create an authentication provider for token based authentication.- Parameters:
tokenSupplier- a supplier of the client auth token- Returns:
- the Authentication object initialized with the token credentials
-
TLS
public static Authentication TLS(java.lang.String certFilePath, java.lang.String keyFilePath)
Create an authentication provider for TLS based authentication.- Parameters:
certFilePath- the path to the TLS client public keykeyFilePath- the path to the TLS client private key- Returns:
- the Authentication object initialized with the TLS credentials
-
create
public static Authentication create(java.lang.String authPluginClassName, java.lang.String authParamsString) throws PulsarClientException.UnsupportedAuthenticationException
Create an instance of theAuthenticationobject by using the plugin class name.- Parameters:
authPluginClassName- name of the Authentication-Plugin you want to useauthParamsString- string which represents parameters for the Authentication-Plugin, e.g., "key1:val1,key2:val2"- Returns:
- instance of the Authentication object
- Throws:
PulsarClientException.UnsupportedAuthenticationException
-
create
public static Authentication create(java.lang.String authPluginClassName, java.util.Map<java.lang.String,java.lang.String> authParams) throws PulsarClientException.UnsupportedAuthenticationException
Create an instance of the Authentication-Plugin.- Parameters:
authPluginClassName- name of the Authentication-Plugin you want to useauthParams- map which represents parameters for the Authentication-Plugin- Returns:
- instance of the Authentication-Plugin
- Throws:
PulsarClientException.UnsupportedAuthenticationException
-
-