/** * 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 */ @SuppressWarnings("deprecation") 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); } } }
} else { auth.configure(configureFromPulsar1AuthParamString(authParamsString));
/** * 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 */ @SuppressWarnings("deprecation") 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); } } }
/** * Create an instance of the Authentication-Plugin * * @param authPluginClassName name of the Authentication-Plugin you want to use * @param authParamsString string which represents parameters for the Authentication-Plugin, e.g., "key1:val1,key2:val2" * @return instance of the Authentication-Plugin * @throws UnsupportedAuthenticationException */ @SuppressWarnings("deprecation") public static final Authentication create(String authPluginClassName, String authParamsString) throws UnsupportedAuthenticationException { try { if (isNotBlank(authPluginClassName)) { Class<?> authClass = Class.forName(authPluginClassName); Authentication auth = (Authentication) authClass.newInstance(); if (auth instanceof EncodedAuthenticationParameterSupport) { // Parse parameters on plugin side. ((EncodedAuthenticationParameterSupport) auth).configure(authParamsString); } else { // Parse parameters by default parse logic. auth.configure(AuthenticationUtil.configureFromPulsar1AuthParamString(authParamsString)); } return auth; } else { return new AuthenticationDisabled(); } } catch (Throwable t) { throw new UnsupportedAuthenticationException(t); } }