use of io.trino.spi.security.GroupProvider in project trino by trinodb.
the class TestFileGroupProvider method testGroupProviderFactory.
@Test
public void testGroupProviderFactory() throws Exception {
File groupFile = new File(Resources.getResource("group.txt").toURI().getPath());
GroupProvider groupProvider = new FileGroupProviderFactory().create(ImmutableMap.of("file.group-file", groupFile.getAbsolutePath()));
assertGroupProvider(groupProvider);
}
use of io.trino.spi.security.GroupProvider in project trino by trinodb.
the class GroupProviderManager method setConfiguredGroupProvider.
private void setConfiguredGroupProvider(String name, Map<String, String> properties) {
requireNonNull(name, "name is null");
requireNonNull(properties, "properties is null");
log.info("-- Loading group provider %s --", name);
GroupProviderFactory factory = groupProviderFactories.get(name);
checkState(factory != null, "Group provider %s is not registered", name);
GroupProvider groupProvider;
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(factory.getClass().getClassLoader())) {
groupProvider = factory.create(ImmutableMap.copyOf(properties));
}
checkState(configuredGroupProvider.compareAndSet(Optional.empty(), Optional.of(groupProvider)), "groupProvider is already set");
log.info("-- Loaded group provider %s --", name);
}
use of io.trino.spi.security.GroupProvider in project trino by trinodb.
the class TestFileGroupProvider method test.
@Test
public void test() throws Exception {
File groupFile = new File(Resources.getResource("group.txt").toURI().getPath());
GroupProvider groupProvider = new FileGroupProvider(new FileGroupConfig().setGroupFile(groupFile));
assertGroupProvider(groupProvider);
}
Aggregations