SecurityProviderRegistration { @Modified public void modified(Configuration configuration) { String[] requiredServicePids = configuration.requiredServicePids(); synchronized (this) { preconditions.clearPreconditions(); for (String pid : requiredServicePids) { preconditions.addPrecondition(pid); } } this.authorizationConfiguration.withCompositionType(configuration.authorizationCompositionType()); maybeUnregister(); maybeRegister(); }  @Activate void activate(BundleContext context, Configuration configuration); @Modified void modified(Configuration configuration); @Deactivate void deactivate(); @Reference(name = "authenticationConfiguration") void bindAuthenticationConfiguration(AuthenticationConfiguration authenticationConfiguration); void unbindAuthenticationConfiguration(AuthenticationConfiguration authenticationConfiguration); @Reference(name = "privilegeConfiguration") void bindPrivilegeConfiguration(PrivilegeConfiguration privilegeConfiguration); void unbindPrivilegeConfiguration(PrivilegeConfiguration privilegeConfiguration); @Reference(name = "userConfiguration") void bindUserConfiguration(UserConfiguration userConfiguration); void unbindUserConfiguration(UserConfiguration userConfiguration); @Reference(name = "rootProvider") void bindRootProvider(RootProvider rootProvider); void unbindRootProvider(RootProvider rootProvider); @Reference(name = "treeProvider") void bindTreeProvider(TreeProvider treeProvider); void unbindTreeProvider(TreeProvider treeProvider); @Reference( name = "authorizationConfiguration", service = AuthorizationConfiguration.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC ) void bindAuthorizationConfiguration(AuthorizationConfiguration configuration, Map<String, Object> properties); void unbindAuthorizationConfiguration(AuthorizationConfiguration configuration, Map<String, Object> properties); @Reference( name = "principalConfiguration", service = PrincipalConfiguration.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC ) void bindPrincipalConfiguration(PrincipalConfiguration configuration, Map<String, Object> properties); void unbindPrincipalConfiguration(PrincipalConfiguration configuration, Map<String, Object> properties); @Reference( name = "tokenConfiguration", service = TokenConfiguration.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC ) void bindTokenConfiguration(TokenConfiguration configuration, Map<String, Object> properties); void unbindTokenConfiguration(TokenConfiguration configuration, Map<String, Object> properties); @Reference( name = "authorizableNodeName", service = AuthorizableNodeName.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC ) void bindAuthorizableNodeName(@NotNull ServiceReference serviceReference, @NotNull AuthorizableNodeName authorizableNodeName); void unbindAuthorizableNodeName(@NotNull ServiceReference serviceReference, @NotNull AuthorizableNodeName authorizableNodeName); @Reference( name = "authorizableActionProvider", service = AuthorizableActionProvider.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC ) void bindAuthorizableActionProvider(@NotNull ServiceReference serviceReference, @NotNull AuthorizableActionProvider authorizableActionProvider); void unbindAuthorizableActionProvider(@NotNull ServiceReference serviceReference, @NotNull AuthorizableActionProvider authorizableActionProvider); @Reference( name = "restrictionProvider", service = RestrictionProvider.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC ) void bindRestrictionProvider(@NotNull ServiceReference serviceReference, @NotNull RestrictionProvider restrictionProvider); void unbindRestrictionProvider(@NotNull ServiceReference serviceReference, @NotNull RestrictionProvider restrictionProvider); @Reference( name = "userAuthenticationFactory", service = UserAuthenticationFactory.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC ) void bindUserAuthenticationFactory(@NotNull ServiceReference serviceReference, @NotNull UserAuthenticationFactory userAuthenticationFactory); void unbindUserAuthenticationFactory(@NotNull ServiceReference serviceReference, @NotNull UserAuthenticationFactory userAuthenticationFactory); @Reference( name = "aggregationFilters", service = AggregationFilter.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) void bindAggregationFilter(@NotNull ServiceReference serviceReference, @NotNull AggregationFilter aggregationFilter); void unbindAggregationFilter(@NotNull ServiceReference serviceReference, @NotNull AggregationFilter aggregationFilter);  }
@Test public void testModified() { registration.activate(context.bundleContext(), configWithRequiredServiceIds("rpId", "authorizationId")); registration.bindAuthorizationConfiguration(new AuthorizationConfigurationImpl(), ImmutableMap.of(SERVICE_PID, "authorizationId")); assertNull(context.getService(SecurityProvider.class)); registration.modified(configWithRequiredServiceIds("authorizationId")); SecurityProvider service = context.getService(SecurityProvider.class); assertNotNull(service); RestrictionProvider rp = service.getConfiguration(AuthorizationConfiguration.class).getRestrictionProvider(); assertTrue(rp instanceof WhiteboardRestrictionProvider); }