Search in sources :

Example 1 with PasswordAuthenticator

use of com.facebook.presto.spi.security.PasswordAuthenticator in project presto by prestodb.

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<>(loadProperties(configFileLocation));
    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 authenticator = factory.create(ImmutableMap.copyOf(properties));
    this.authenticator.set(requireNonNull(authenticator, "authenticator is null"));
    log.info("-- Loaded password authenticator %s --", name);
}
Also used : PasswordAuthenticatorFactory(com.facebook.presto.spi.security.PasswordAuthenticatorFactory) PasswordAuthenticator(com.facebook.presto.spi.security.PasswordAuthenticator) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) File(java.io.File)

Aggregations

PasswordAuthenticator (com.facebook.presto.spi.security.PasswordAuthenticator)1 PasswordAuthenticatorFactory (com.facebook.presto.spi.security.PasswordAuthenticatorFactory)1 File (java.io.File)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1