use of org.apache.jackrabbit.oak.security.authorization.restriction.WhiteboardRestrictionProvider in project jackrabbit-oak by apache.
the class SecurityProviderRegistrationTest method testActivateWithMixedServicePiAnddOakServiceName.
@Test
public void testActivateWithMixedServicePiAnddOakServiceName() {
registration.activate(context.bundleContext(), configWithRequiredServiceIds("rpId", "authorizationId"));
RestrictionProvider mockRp = Mockito.mock(RestrictionProvider.class);
registration.bindRestrictionProvider(mockRp, ImmutableMap.of(Constants.SERVICE_PID, "rpId"));
registration.bindAuthorizationConfiguration(new AuthorizationConfigurationImpl(), ImmutableMap.of(RegistrationConstants.OAK_SECURITY_NAME, "authorizationId"));
SecurityProvider service = context.getService(SecurityProvider.class);
RestrictionProvider rp = service.getConfiguration(AuthorizationConfiguration.class).getRestrictionProvider();
assertTrue(rp instanceof WhiteboardRestrictionProvider);
}
use of org.apache.jackrabbit.oak.security.authorization.restriction.WhiteboardRestrictionProvider in project jackrabbit-oak by apache.
the class SecurityProviderRegistrationTest method testModified.
@Test
public void testModified() {
registration.activate(context.bundleContext(), configWithRequiredServiceIds("rpId", "authorizationId"));
registration.bindAuthorizationConfiguration(new AuthorizationConfigurationImpl(), ImmutableMap.of(Constants.SERVICE_PID, "authorizationId"));
assertNull(context.getService(SecurityProvider.class));
// modify requiredServiceIds by removing the rpId from the mandatory services
// => should re-register the security provider
registration.modified(configWithRequiredServiceIds("authorizationId"));
SecurityProvider service = context.getService(SecurityProvider.class);
assertNotNull(service);
RestrictionProvider rp = service.getConfiguration(AuthorizationConfiguration.class).getRestrictionProvider();
assertTrue(rp instanceof WhiteboardRestrictionProvider);
}
use of org.apache.jackrabbit.oak.security.authorization.restriction.WhiteboardRestrictionProvider in project jackrabbit-oak by apache.
the class SecurityProviderRegistrationTest method testBindRestrictionProviderWithAuthorizationConfig.
@Test
public void testBindRestrictionProviderWithAuthorizationConfig() {
registration.activate(context.bundleContext(), configWithRequiredServiceIds("rpId", "authorizationId"));
RestrictionProvider mockRp = Mockito.mock(RestrictionProvider.class);
registration.bindRestrictionProvider(mockRp, ImmutableMap.of(Constants.SERVICE_PID, "rpId"));
registration.bindAuthorizationConfiguration(new AuthorizationConfigurationImpl(), ImmutableMap.of(Constants.SERVICE_PID, "authorizationId"));
SecurityProvider service = context.getService(SecurityProvider.class);
RestrictionProvider rp = service.getConfiguration(AuthorizationConfiguration.class).getRestrictionProvider();
assertTrue(rp instanceof WhiteboardRestrictionProvider);
}
Aggregations