use of org.keycloak.authorization.store.syncronization.Synchronizer in project keycloak by keycloak.
the class AuthorizationStoreFactory method registerSynchronizationListeners.
default void registerSynchronizationListeners(KeycloakSessionFactory factory) {
Map<Class<? extends ProviderEvent>, Synchronizer> synchronizers = new HashMap<>();
synchronizers.put(ClientRemovedEvent.class, new ClientApplicationSynchronizer());
synchronizers.put(RealmRemovedEvent.class, new RealmSynchronizer());
synchronizers.put(UserRemovedEvent.class, new UserSynchronizer());
synchronizers.put(GroupModel.GroupRemovedEvent.class, new GroupSynchronizer());
factory.register(event -> {
try {
synchronizers.forEach((eventType, synchronizer) -> {
if (eventType.isInstance(event)) {
synchronizer.synchronize(event, factory);
}
});
} catch (Exception e) {
throw new RuntimeException("Error synchronizing authorization data.", e);
}
});
}
Aggregations