From bee8d1f39bdaf1a9d2bf76442a3204955262a089 Mon Sep 17 00:00:00 2001 From: Alex Morel Date: Fri, 21 Jun 2024 09:45:57 +0200 Subject: [PATCH] Renaming ScimStorageProviderFactory --- .../java/sh/libre/scim/core/ScimDispatcher.java | 6 +++--- .../scim/event/ScimEventListenerProvider.java | 4 ++-- ...ointConfigurationStorageProviderFactory.java} | 16 ++++++++-------- ...g.keycloak.storage.UserStorageProviderFactory | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) rename src/main/java/sh/libre/scim/storage/{ScimStorageProviderFactory.java => ScimEndpointConfigurationStorageProviderFactory.java} (90%) diff --git a/src/main/java/sh/libre/scim/core/ScimDispatcher.java b/src/main/java/sh/libre/scim/core/ScimDispatcher.java index 142d3ffe10..7db4e62938 100644 --- a/src/main/java/sh/libre/scim/core/ScimDispatcher.java +++ b/src/main/java/sh/libre/scim/core/ScimDispatcher.java @@ -3,7 +3,7 @@ package sh.libre.scim.core; import org.jboss.logging.Logger; import org.keycloak.component.ComponentModel; import org.keycloak.models.KeycloakSession; -import sh.libre.scim.storage.ScimStorageProviderFactory; +import sh.libre.scim.storage.ScimEndpointConfigurationStorageProviderFactory; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -53,7 +53,7 @@ public class ScimDispatcher { // Step 2: Get All SCIM endpoints defined in Admin Console (enabled ScimStorageProviderFactory) session.getContext().getRealm().getComponentsStream() - .filter(m -> ScimStorageProviderFactory.ID.equals(m.getProviderId()) + .filter(m -> ScimEndpointConfigurationStorageProviderFactory.ID.equals(m.getProviderId()) && m.get("enabled", true)) .forEach(scimEndpointConfigurationRaw -> { ScrimProviderConfiguration scrimProviderConfiguration = new ScrimProviderConfiguration(scimEndpointConfigurationRaw); @@ -115,7 +115,7 @@ public class ScimDispatcher { } } - public void close() throws Exception { + public void close() { sessionToScimDispatcher.remove(session); for (GroupScimService c : groupScimServices) { c.close(); diff --git a/src/main/java/sh/libre/scim/event/ScimEventListenerProvider.java b/src/main/java/sh/libre/scim/event/ScimEventListenerProvider.java index 0a57d5afca..1fe84ad2d7 100644 --- a/src/main/java/sh/libre/scim/event/ScimEventListenerProvider.java +++ b/src/main/java/sh/libre/scim/event/ScimEventListenerProvider.java @@ -21,8 +21,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * An {@link java.util.EventListener} in charge of reaction to Keycloak models - * modification (e.g. User creation, Group deletion, membership modifications...) + * An Event listener reacting to Keycloak models modification + * (e.g. User creation, Group deletion, membership modifications, endpoint configuration change...) * by propagating it to all registered Scim endpoints. */ public class ScimEventListenerProvider implements EventListenerProvider { diff --git a/src/main/java/sh/libre/scim/storage/ScimStorageProviderFactory.java b/src/main/java/sh/libre/scim/storage/ScimEndpointConfigurationStorageProviderFactory.java similarity index 90% rename from src/main/java/sh/libre/scim/storage/ScimStorageProviderFactory.java rename to src/main/java/sh/libre/scim/storage/ScimEndpointConfigurationStorageProviderFactory.java index 920b830f1c..bac304e3ae 100644 --- a/src/main/java/sh/libre/scim/storage/ScimStorageProviderFactory.java +++ b/src/main/java/sh/libre/scim/storage/ScimEndpointConfigurationStorageProviderFactory.java @@ -26,12 +26,12 @@ import java.util.Date; import java.util.List; /** - * Allows to register Scim endpoints through Admin console, using the provided config properties. + * Allows to register and configure Scim endpoints through Admin console, using the provided config properties. */ -public class ScimStorageProviderFactory - implements UserStorageProviderFactory, ImportSynchronization { +public class ScimEndpointConfigurationStorageProviderFactory + implements UserStorageProviderFactory, ImportSynchronization { public static final String ID = "scim"; - private final Logger logger = Logger.getLogger(ScimStorageProviderFactory.class); + private final Logger logger = Logger.getLogger(ScimEndpointConfigurationStorageProviderFactory.class); @Override public String getId() { @@ -164,14 +164,14 @@ public class ScimStorageProviderFactory @Override - public ScimStorageProvider create(KeycloakSession session, ComponentModel model) { - return new ScimStorageProvider(); + public ScimEndpointConfigurationStorageProvider create(KeycloakSession session, ComponentModel model) { + return new ScimEndpointConfigurationStorageProvider(); } /** - * Empty implementation : we used this {@link ScimStorageProviderFactory} to generate Admin Console page. + * Empty implementation : we used this {@link ScimEndpointConfigurationStorageProviderFactory} to generate Admin Console page. */ - public static final class ScimStorageProvider implements UserStorageProvider { + public static final class ScimEndpointConfigurationStorageProvider implements UserStorageProvider { @Override public void close() { // Nothing to close here diff --git a/src/main/resources/META-INF/services/org.keycloak.storage.UserStorageProviderFactory b/src/main/resources/META-INF/services/org.keycloak.storage.UserStorageProviderFactory index 255bddacd6..23371ddf7c 100644 --- a/src/main/resources/META-INF/services/org.keycloak.storage.UserStorageProviderFactory +++ b/src/main/resources/META-INF/services/org.keycloak.storage.UserStorageProviderFactory @@ -1 +1 @@ -sh.libre.scim.storage.ScimStorageProviderFactory +sh.libre.scim.storage.ScimEndpointConfigurationStorageProviderFactory