use of org.apache.jackrabbit.oak.spi.security.authorization.OpenAuthorizationConfiguration in project jackrabbit-oak by apache.
the class CompositeAuthorizationConfigurationTest method testMultipleGetPermissionProvider3.
@Test
public void testMultipleGetPermissionProvider3() {
CompositeAuthorizationConfiguration cc = getCompositeConfiguration(new OpenAuthorizationConfiguration(), new OpenAuthorizationConfiguration());
PermissionProvider pp = cc.getPermissionProvider(root, root.getContentSession().getWorkspaceName(), Collections.<Principal>emptySet());
assertFalse(pp instanceof CompositePermissionProvider);
assertSame(EmptyPermissionProvider.getInstance(), pp);
}
use of org.apache.jackrabbit.oak.spi.security.authorization.OpenAuthorizationConfiguration 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.authorization.OpenAuthorizationConfiguration in project jackrabbit-oak by apache.
the class CompositeAuthorizationConfigurationTest method testOnlyEmptyRestrictionProvider.
@Test
public void testOnlyEmptyRestrictionProvider() {
AuthorizationConfiguration ac = new OpenAuthorizationConfiguration() {
@Nonnull
@Override
public RestrictionProvider getRestrictionProvider() {
return RestrictionProvider.EMPTY;
}
};
CompositeAuthorizationConfiguration cc = getCompositeConfiguration(ac, ac);
RestrictionProvider rp = cc.getRestrictionProvider();
assertFalse(rp instanceof CompositeRestrictionProvider);
assertSame(RestrictionProvider.EMPTY, rp);
}
use of org.apache.jackrabbit.oak.spi.security.authorization.OpenAuthorizationConfiguration in project jackrabbit-oak by apache.
the class CompositeAuthorizationConfigurationTest method testMultipleGetPermissionProvider.
@Test
public void testMultipleGetPermissionProvider() {
CompositeAuthorizationConfiguration cc = getCompositeConfiguration(new OpenAuthorizationConfiguration(), new AuthorizationConfigurationImpl(getSecurityProvider()));
PermissionProvider pp = cc.getPermissionProvider(root, root.getContentSession().getWorkspaceName(), Collections.<Principal>emptySet());
assertFalse(pp instanceof CompositePermissionProvider);
}
use of org.apache.jackrabbit.oak.spi.security.authorization.OpenAuthorizationConfiguration in project jackrabbit-oak by apache.
the class CompositeAuthorizationConfigurationTest method testMultipleWithEmptyRestrictionProvider.
@Test
public void testMultipleWithEmptyRestrictionProvider() {
CompositeAuthorizationConfiguration cc = getCompositeConfiguration(new AuthorizationConfigurationImpl(getSecurityProvider()), new OpenAuthorizationConfiguration() {
@Nonnull
@Override
public RestrictionProvider getRestrictionProvider() {
return RestrictionProvider.EMPTY;
}
});
RestrictionProvider rp = cc.getRestrictionProvider();
assertFalse(rp instanceof CompositeRestrictionProvider);
assertNotSame(RestrictionProvider.EMPTY, rp);
}
Aggregations