use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.
the class MutableRootTest method before.
@Before
public void before() {
SecurityProvider sp = new OpenSecurityProvider() {
@Nonnull
@Override
public <T> T getConfiguration(@Nonnull Class<T> configClass) {
if (AuthorizationConfiguration.class == configClass) {
return (T) new OpenAuthorizationConfiguration() {
@Nonnull
@Override
public PermissionProvider getPermissionProvider(@Nonnull Root root, @Nonnull String workspaceName, @Nonnull Set<Principal> principals) {
return permissionProvider;
}
};
} else {
return super.getConfiguration(configClass);
}
}
};
ContentSessionImpl cs = Mockito.mock(ContentSessionImpl.class);
when(cs.toString()).thenReturn("contentSession");
when(cs.getAuthInfo()).thenReturn(AuthInfoImpl.EMPTY);
when(cs.getWorkspaceName()).thenReturn("default");
root = new MutableRoot(store, new EmptyHook(), "default", new Subject(), sp, null, null, cs);
}
use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.
the class DefaultConflictHandlerTheirsTest method setUp.
@Before
public void setUp() throws CommitFailedException {
ContentSession session = new Oak().with(new OpenSecurityProvider()).with(DefaultConflictHandler.THEIRS).createContentSession();
// Add test content
Root root = session.getLatestRoot();
Tree tree = root.getTree("/");
tree.setProperty("a", 1);
tree.setProperty("b", 2);
tree.setProperty("c", 3);
tree.addChild("x");
tree.addChild("y");
tree.addChild("z");
root.commit();
ourRoot = session.getLatestRoot();
theirRoot = session.getLatestRoot();
}
use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.
the class PropertyIndexQueryTest method testInvalidNamespace.
@Ignore("OAK-1517")
@Test
public void testInvalidNamespace() throws Exception {
new Oak().with(new InitialContent()).with(new OpenSecurityProvider()).with(new PropertyIndexEditorProvider()).with(new RepositoryInitializer() {
@Override
public void initialize(@Nonnull NodeBuilder builder) {
createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME), "foo", true, false, ImmutableSet.of("illegal:namespaceProperty"), null);
}
}).createContentRepository();
fail("creating an index definition with an illegal namespace should fail.");
}
use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.
the class PrivilegeDefinitionReaderTest method testMissingPermissionRoot.
@Test
public void testMissingPermissionRoot() throws Exception {
ContentRepository repo = new Oak().with(new OpenSecurityProvider()).createContentRepository();
Root tmpRoot = repo.login(null, null).getLatestRoot();
try {
PrivilegeDefinitionReader reader = new PrivilegeDefinitionReader(tmpRoot);
assertNull(reader.readDefinition(JCR_READ));
} finally {
tmpRoot.getContentSession().close();
}
}
use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.
the class UserProviderTest method setUp.
@Before
public void setUp() throws Exception {
root = new Oak().with(new OpenSecurityProvider()).with(new InitialContent()).with(new PropertyIndexEditorProvider()).createRoot();
defaultConfig = ConfigurationParameters.EMPTY;
defaultUserPath = defaultConfig.getConfigValue(UserConstants.PARAM_USER_PATH, UserConstants.DEFAULT_USER_PATH);
defaultGroupPath = defaultConfig.getConfigValue(UserConstants.PARAM_GROUP_PATH, UserConstants.DEFAULT_GROUP_PATH);
customOptions = new HashMap<String, Object>();
customOptions.put(UserConstants.PARAM_GROUP_PATH, customGroupPath);
customOptions.put(UserConstants.PARAM_USER_PATH, customUserPath);
}
Aggregations