Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Add display name to identity provider API (#1969)

Wouter Born2fbb71d7021b
diff --git a/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java b/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java
index f32509e09..6cc815b18 100644
--- a/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java
+++ b/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java
@@ -1040,7 +1040,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider im
* <li>{@code providerId}: The identity provider ({@code oidc} or {@code saml}) to import the configuration for.</li></ul>
*
* @return the imported configuration parameters which can be added to the {@link Map} provided to
- * {@link #createUpdateIdentityProvider(String, String, String, Map)} when creating or updating an identity provider.
+ * {@link #createUpdateIdentityProvider(String, String, String, String, Map)} when creating or updating an identity provider.
*/
public Map<String, String> getIdentityProviderImportConfig(String realm, Map<String, Object> importData) {
if (importData == null || importData.isEmpty()) {
@@ -1050,10 +1050,11 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider im
return getRealms(realmsResource -> realmsResource.realm(realm).identityProviders().importFrom(importData));
}
- public void createUpdateIdentityProvider(String realm, String alias, String providerId, Map<String, String> config) {
+ public void createUpdateIdentityProvider(String realm, String alias, String providerId, String displayName, Map<String, String> config) {
IdentityProviderRepresentation representation = new IdentityProviderRepresentation();
representation.setAlias(alias);
representation.setProviderId(providerId);
+ representation.setDisplayName(displayName);
representation.setConfig(config);
getRealms(realmsResource -> {
diff --git a/test/src/test/groovy/org/openremote/test/security/IdentityProviderTest.groovy b/test/src/test/groovy/org/openremote/test/security/IdentityProviderTest.groovy
index b8cd6db3b..bf18a3c3e 100644
--- a/test/src/test/groovy/org/openremote/test/security/IdentityProviderTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/security/IdentityProviderTest.groovy
@@ -113,12 +113,15 @@ class IdentityProviderTest extends Specification implements ManagerContainerTrai
idpConfig.put("claimFilterName", "claimName");
idpConfig.put("claimFilterValue", "claimValue");
- identityProvider.createUpdateIdentityProvider(realmName, idpAlias, "oidc", idpConfig);
+ identityProvider.createUpdateIdentityProvider(realmName, idpAlias, "oidc", "IdP Name", idpConfig);
then: "the identity provider is created in the realm"
identityProvider.getRealms { realmsResource ->
IdentityProvidersResource identityProvidersResource = realmsResource.realm(realmName).identityProviders();
- assert identityProvidersResource.findAll().stream().anyMatch(ipr -> idpAlias == ipr.getAlias())
+ def ipr = identityProvidersResource.findAll().stream().filter(ipr -> idpAlias == ipr.getAlias()).findFirst()
+ assert ipr.isPresent()
+ assert ipr.get().getProviderId() == "oidc"
+ assert ipr.get().getDisplayName() == "IdP Name"
return null
} == null