use of org.apache.jackrabbit.oak.security.user.UserConfigurationImpl in project jackrabbit-oak by apache.
the class PrincipalConfigurationImplTest method testGetPrincipalProvider4.
@Test
public void testGetPrincipalProvider4() {
PrincipalConfigurationImpl pc3 = new PrincipalConfigurationImpl();
final SecurityProvider sp = new SecurityProvider() {
@Nonnull
@Override
public ConfigurationParameters getParameters(@Nullable String name) {
return ConfigurationParameters.EMPTY;
}
@Nonnull
@Override
public Iterable<? extends SecurityConfiguration> getConfigurations() {
return ImmutableList.of();
}
@Nonnull
@Override
public <T> T getConfiguration(@Nonnull Class<T> configClass) {
if (configClass.equals(UserConfiguration.class)) {
return (T) new UserConfigurationImpl(this) {
@Nullable
@Override
public PrincipalProvider getUserPrincipalProvider(@Nonnull Root root, @Nonnull NamePathMapper namePathMapper) {
return null;
}
};
} else {
throw new IllegalArgumentException();
}
}
};
pc3.setSecurityProvider(sp);
PrincipalProvider pp = pc3.getPrincipalProvider(root, NamePathMapper.DEFAULT);
assertTrue(pp instanceof PrincipalProviderImpl);
}
Aggregations