Search in sources :

Example 1 with PasswordAuthenticator

use of io.prestosql.spi.security.PasswordAuthenticator in project hetu-core by openlookeng.

the class PasswordAuthenticatorManager method loadPasswordAuthenticator.

public void loadPasswordAuthenticator() throws Exception {
    if (!required.get()) {
        return;
    }
    File configFileLocation = CONFIG_FILE.getAbsoluteFile();
    Map<String, String> properties = new HashMap<>(loadPropertiesFrom(configFileLocation.getPath()));
    String name = properties.remove(NAME_PROPERTY);
    checkArgument(!isNullOrEmpty(name), "Password authenticator configuration %s does not contain %s", configFileLocation, NAME_PROPERTY);
    log.info("-- Loading password authenticator --");
    PasswordAuthenticatorFactory factory = factories.get(name);
    checkState(factory != null, "Password authenticator %s is not registered", name);
    PasswordAuthenticator tmpAuthenticator = factory.create(ImmutableMap.copyOf(properties));
    this.authenticator.set(requireNonNull(tmpAuthenticator, "authenticator is null"));
    log.info("-- Loaded password authenticator %s --", name);
}
Also used : PasswordAuthenticatorFactory(io.prestosql.spi.security.PasswordAuthenticatorFactory) PasswordAuthenticator(io.prestosql.spi.security.PasswordAuthenticator) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) File(java.io.File)

Aggregations

PasswordAuthenticator (io.prestosql.spi.security.PasswordAuthenticator)1 PasswordAuthenticatorFactory (io.prestosql.spi.security.PasswordAuthenticatorFactory)1 File (java.io.File)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1