Search in sources :

Example 1 with ClientApplicationSynchronizer

use of org.keycloak.authorization.store.syncronization.ClientApplicationSynchronizer 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);
        }
    });
}
Also used : ProviderEvent(org.keycloak.provider.ProviderEvent) GroupSynchronizer(org.keycloak.authorization.store.syncronization.GroupSynchronizer) RealmSynchronizer(org.keycloak.authorization.store.syncronization.RealmSynchronizer) UserSynchronizer(org.keycloak.authorization.store.syncronization.UserSynchronizer) Synchronizer(org.keycloak.authorization.store.syncronization.Synchronizer) ClientApplicationSynchronizer(org.keycloak.authorization.store.syncronization.ClientApplicationSynchronizer) UserSynchronizer(org.keycloak.authorization.store.syncronization.UserSynchronizer) GroupSynchronizer(org.keycloak.authorization.store.syncronization.GroupSynchronizer) HashMap(java.util.HashMap) RealmSynchronizer(org.keycloak.authorization.store.syncronization.RealmSynchronizer) ClientApplicationSynchronizer(org.keycloak.authorization.store.syncronization.ClientApplicationSynchronizer) GroupModel(org.keycloak.models.GroupModel)

Aggregations

HashMap (java.util.HashMap)1 ClientApplicationSynchronizer (org.keycloak.authorization.store.syncronization.ClientApplicationSynchronizer)1 GroupSynchronizer (org.keycloak.authorization.store.syncronization.GroupSynchronizer)1 RealmSynchronizer (org.keycloak.authorization.store.syncronization.RealmSynchronizer)1 Synchronizer (org.keycloak.authorization.store.syncronization.Synchronizer)1 UserSynchronizer (org.keycloak.authorization.store.syncronization.UserSynchronizer)1 GroupModel (org.keycloak.models.GroupModel)1 ProviderEvent (org.keycloak.provider.ProviderEvent)1