*/
public final class SecurityEntityFilteringFeature implements Feature {
@Override
public boolean configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
if (!config.isRegistered(SecurityEntityProcessor.class)) {
// RolesAllowed feature.
if (!config.isRegistered(RolesAllowedDynamicFeature.class)) {
context.register(RolesAllowedDynamicFeature.class);
}
// Binder (FilteringObjectProvider/FilteringGraphTransformer).
if (!config.isRegistered(EntityFilteringBinder.class)) {
context.register(new EntityFilteringBinder());
}
// Entity Processors.
context.register(SecurityEntityProcessor.class);
if (!config.isRegistered(DefaultEntityProcessor.class)) {
context.register(DefaultEntityProcessor.class);
}
// Scope Providers.
context.register(SecurityScopeResolver.class);
if (RuntimeType.SERVER.equals(config.getRuntimeType())) {
context.register(SecurityServerScopeResolver.class);
}
// Scope Resolver.
if (RuntimeType.SERVER == config.getRuntimeType()) {
context.register(SecurityServerScopeProvider.class);
} else {
context.register(CommonScopeProvider.class);
}