Search in sources :

Example 1 with UnsupportedAuthenticationException

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);
    }
}
Also used : Authentication(com.yahoo.pulsar.client.api.Authentication) AuthenticationDisabled(com.yahoo.pulsar.client.impl.auth.AuthenticationDisabled) UnsupportedAuthenticationException(com.yahoo.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException)

Aggregations

Authentication (com.yahoo.pulsar.client.api.Authentication)1 UnsupportedAuthenticationException (com.yahoo.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException)1 AuthenticationDisabled (com.yahoo.pulsar.client.impl.auth.AuthenticationDisabled)1