use of com.yahoo.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException in project pulsar by yahoo.
the class AuthenticationFactory method create.
/**
* Create an instance of the Authentication-Plugin
*
* @param authPluginClassName
* name of the Authentication-Plugin you want to use
* @param authParams
* map which represents parameters for the Authentication-Plugin
* @return instance of the Authentication-Plugin
* @throws UnsupportedAuthenticationException
*/
public static final Authentication create(String authPluginClassName, Map<String, String> authParams) throws UnsupportedAuthenticationException {
try {
if (isNotBlank(authPluginClassName)) {
Class<?> authClass = Class.forName(authPluginClassName);
Authentication auth = (Authentication) authClass.newInstance();
auth.configure(authParams);
return auth;
} else {
return new AuthenticationDisabled();
}
} catch (Throwable t) {
throw new UnsupportedAuthenticationException(t);
}
}
Aggregations