100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Updated keycloak gradle version Moved restricted user from UserConfiguration to realm role.
Michael Rademakerccd7b4678e41
diff --git a/gradle.properties b/gradle.propertiesindex 2db1a634c..2825c0101 100644--- a/gradle.properties+++ b/gradle.properties@@ -12,7 +12,7 @@ undertowVersion = 2.2.3.FinalresteasyVersion = 3.14.0.FinalresteasyVersionAsyncHttpServlet = 3.0.19.FinaljbossLoggingAnnotationsVersion = 2.0.2.Final-keycloakVersion = 12.0.1+keycloakVersion = 13.0.1jacksonVersion = 2.11.4groovyVersion = 2.5.14groovySandboxVersion = 1.19diff --git a/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java b/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.javaindex 7aaffde22..a9971dfc0 100644--- a/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java+++ b/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java@@ -324,7 +324,7 @@ public class AssetProcessingService extends RouteBuilder implements ContainerSer}// Check restricted user- if (identityService.getIdentityProvider().isRestrictedUser(authContext.getUserId())) {+ if (identityService.getIdentityProvider().isRestrictedUser(authContext)) {// Must be asset linked to userif (!assetStorageService.isUserAsset(authContext.getUserId(),event.getAssetId())) {diff --git a/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java b/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.javaindex 8a93fe7ac..55a33ee74 100644--- a/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java+++ b/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java@@ -164,7 +164,7 @@ public class AssetStorageService extends RouteBuilder implements ContainerServicreturn false;}- boolean isRestrictedUser = identityService.getIdentityProvider().isRestrictedUser(auth.getUserId());+ boolean isRestrictedUser = identityService.getIdentityProvider().isRestrictedUser(auth);if (filter == null) {filter = new AssetFilter<>();@@ -382,7 +382,7 @@ public class AssetStorageService extends RouteBuilder implements ContainerServicreturn;}- Access access = authContext.isSuperUser() || !identityService.getIdentityProvider().isRestrictedUser(authContext.getUserId()) ? PRIVATE : PROTECTED;+ Access access = authContext.isSuperUser() || !identityService.getIdentityProvider().isRestrictedUser(authContext) ? PRIVATE : PROTECTED;Asset<?> asset = find(new AssetQuery()@@ -424,7 +424,7 @@ public class AssetStorageService extends RouteBuilder implements ContainerServicreturn;}- Access access = authContext.isSuperUser() || !identityService.getIdentityProvider().isRestrictedUser(authContext.getUserId()) ? PRIVATE : PROTECTED;+ Access access = authContext.isSuperUser() || !identityService.getIdentityProvider().isRestrictedUser(authContext) ? PRIVATE : PROTECTED;if (!authContext.isSuperUser()) {// Force realm to match usersdiff --git a/manager/src/main/java/org/openremote/manager/event/ClientEventService.java b/manager/src/main/java/org/openremote/manager/event/ClientEventService.javaindex c42c181ad..a2d55f1d7 100644--- a/manager/src/main/java/org/openremote/manager/event/ClientEventService.java+++ b/manager/src/main/java/org/openremote/manager/event/ClientEventService.java@@ -245,7 +245,7 @@ public class ClientEventService implements ContainerService {EventSubscription<?> subscription = exchange.getIn().getBody(EventSubscription.class);AuthContext authContext = exchange.getIn().getHeader(Constants.AUTH_CONTEXT, AuthContext.class);if (authorizeEventSubscription(authContext, subscription)) {- boolean restrictedUser = identityService.getIdentityProvider().isRestrictedUser(authContext.getUserId());+ boolean restrictedUser = identityService.getIdentityProvider().isRestrictedUser(authContext);eventSubscriptions.createOrUpdate(sessionKey, restrictedUser, subscription);subscription.setSubscribed(true);sendToSession(sessionKey, subscription);diff --git a/manager/src/main/java/org/openremote/manager/mqtt/ORAuthorizatorPolicy.java b/manager/src/main/java/org/openremote/manager/mqtt/ORAuthorizatorPolicy.javaindex d3341ce98..3c21e6739 100644--- a/manager/src/main/java/org/openremote/manager/mqtt/ORAuthorizatorPolicy.java+++ b/manager/src/main/java/org/openremote/manager/mqtt/ORAuthorizatorPolicy.java@@ -135,7 +135,7 @@ public class ORAuthorizatorPolicy implements IAuthorizatorPolicy {if (Pattern.matches(Constants.ASSET_ID_REGEXP, assetId)) {Asset<?> asset;- if(identityProvider.isRestrictedUser(authContext.getUserId())) {+ if(identityProvider.isRestrictedUser(authContext)) {Optional<UserAsset> userAsset = assetStorageService.findUserAssets(connection.realm, authContext.getUserId(), assetId).stream().findFirst();asset = userAsset.map(value -> assetStorageService.find(value.getId().getAssetId())).orElse(null);} else {diff --git a/manager/src/main/java/org/openremote/manager/notification/NotificationResourceImpl.java b/manager/src/main/java/org/openremote/manager/notification/NotificationResourceImpl.javaindex 333502641..e8dc49c9f 100644--- a/manager/src/main/java/org/openremote/manager/notification/NotificationResourceImpl.java+++ b/manager/src/main/java/org/openremote/manager/notification/NotificationResourceImpl.java@@ -193,7 +193,7 @@ public class NotificationResourceImpl extends WebResource implements Notificatio} else {// Regular users can only update notifications sent to them or assets in their realm// Restricted users can only update notifications sent to them or assets linked to them- boolean isRestrictedUser = managerIdentityService.getIdentityProvider().isRestrictedUser(getUserId());+ boolean isRestrictedUser = managerIdentityService.getIdentityProvider().isRestrictedUser(getAuthContext());switch (sentNotification.getTarget()) {case TENANT:diff --git a/manager/src/main/java/org/openremote/manager/notification/NotificationService.java b/manager/src/main/java/org/openremote/manager/notification/NotificationService.javaindex a795d9f96..376932365 100644--- a/manager/src/main/java/org/openremote/manager/notification/NotificationService.java+++ b/manager/src/main/java/org/openremote/manager/notification/NotificationService.java@@ -196,7 +196,7 @@ public class NotificationService extends RouteBuilder implements ContainerServicuserId = authContext.getUserId();sourceId.set(userId);isSuperUser = authContext.isSuperUser();- isRestrictedUser = identityService.getIdentityProvider().isRestrictedUser(authContext.getUserId());+ isRestrictedUser = identityService.getIdentityProvider().isRestrictedUser(authContext);break;case GLOBAL_RULESET:diff --git a/manager/src/main/java/org/openremote/manager/persistence/ManagerEntityClassProvider.java b/manager/src/main/java/org/openremote/manager/persistence/ManagerEntityClassProvider.javadeleted file mode 100644index ef7055cb8..000000000--- a/manager/src/main/java/org/openremote/manager/persistence/ManagerEntityClassProvider.java+++ /dev/null@@ -1,35 +0,0 @@-/*- * Copyright 2020, OpenRemote Inc.- *- * See the CONTRIBUTORS.txt file in the distribution for a- * full listing of individual contributors.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <http://www.gnu.org/licenses/>.- */-package org.openremote.manager.persistence;--import org.openremote.manager.security.UserConfiguration;-import org.openremote.model.EntityClassProvider;--import java.util.Arrays;-import java.util.List;--public class ManagerEntityClassProvider implements EntityClassProvider {- @Override- public List<Class<?>> getEntityClasses() {- return Arrays.asList(- UserConfiguration.class- );- }-}diff --git a/manager/src/main/java/org/openremote/manager/rules/RulesService.java b/manager/src/main/java/org/openremote/manager/rules/RulesService.javaindex 5d5d04908..cc2f70efb 100644--- a/manager/src/main/java/org/openremote/manager/rules/RulesService.java+++ b/manager/src/main/java/org/openremote/manager/rules/RulesService.java@@ -168,7 +168,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Assereturn false;}- boolean isRestrictedUser = identityService.getIdentityProvider().isRestrictedUser(auth.getUserId());+ boolean isRestrictedUser = identityService.getIdentityProvider().isRestrictedUser(auth);return !isRestrictedUser;}diff --git a/manager/src/main/java/org/openremote/manager/security/ManagerBasicIdentityProvider.java b/manager/src/main/java/org/openremote/manager/security/ManagerBasicIdentityProvider.javaindex 721bf2eb3..874a84871 100644--- a/manager/src/main/java/org/openremote/manager/security/ManagerBasicIdentityProvider.java+++ b/manager/src/main/java/org/openremote/manager/security/ManagerBasicIdentityProvider.java@@ -203,7 +203,7 @@ public class ManagerBasicIdentityProvider extends BasicIdentityProvider implemen}@Override- public boolean isRestrictedUser(String userId) {+ public boolean isRestrictedUser(AuthContext authContext) {return false;}diff --git a/manager/src/main/java/org/openremote/manager/security/ManagerIdentityProvider.java b/manager/src/main/java/org/openremote/manager/security/ManagerIdentityProvider.javaindex e5ce52524..f6ab520ad 100644--- a/manager/src/main/java/org/openremote/manager/security/ManagerIdentityProvider.java+++ b/manager/src/main/java/org/openremote/manager/security/ManagerIdentityProvider.java@@ -77,7 +77,7 @@ public interface ManagerIdentityProvider extends IdentityProvider {boolean isMasterRealmAdmin(String userId);- boolean isRestrictedUser(String userId);+ boolean isRestrictedUser(AuthContext authContext);boolean isUserInTenant(String userId, String realm);diff --git a/manager/src/main/java/org/openremote/manager/security/ManagerIdentityService.java b/manager/src/main/java/org/openremote/manager/security/ManagerIdentityService.javaindex 5cee55ff9..7b83b76cd 100644--- a/manager/src/main/java/org/openremote/manager/security/ManagerIdentityService.java+++ b/manager/src/main/java/org/openremote/manager/security/ManagerIdentityService.java@@ -72,30 +72,6 @@ public class ManagerIdentityService extends IdentityService {return identityProvider;}- public UserConfiguration getUserConfiguration(String userId) {- return persistenceService.doReturningTransaction(entityManager -> getUserConfiguration(entityManager, userId));- }-- protected UserConfiguration getUserConfiguration(EntityManager em, String userId) {- UserConfiguration userConfiguration = em.find(UserConfiguration.class, userId);- if (userConfiguration == null) {- userConfiguration = new UserConfiguration(userId);- userConfiguration = mergeUserConfiguration(em, userConfiguration);- }- return userConfiguration;- }-- public UserConfiguration mergeUserConfiguration(UserConfiguration userConfiguration) {- return persistenceService.doReturningTransaction(entityManager -> mergeUserConfiguration(entityManager, userConfiguration));- }-- protected UserConfiguration mergeUserConfiguration(EntityManager em, UserConfiguration userConfiguration) {- if (userConfiguration.getUserId() == null || userConfiguration.getUserId().length() == 0) {- throw new IllegalArgumentException("User ID must be set on: " + userConfiguration);- }- return em.merge(userConfiguration);- }-@Overridepublic String toString() {return getClass().getSimpleName() + "{" +diff --git a/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java b/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.javaindex 11d69f6b4..6cb5e4102 100644--- a/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java+++ b/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java@@ -87,6 +87,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider impublic static final String DEFAULT_REALM_KEYCLOAK_THEME_DEFAULT = "openremote";public static final String KEYCLOAK_GRANT_FILE = "KEYCLOAK_GRANT_FILE";public static final String KEYCLOAK_GRANT_FILE_DEFAULT = "manager/build/keycloak.json";+ public static final String KEYCLOAK_DEFAULT_ROLES_PREFIX = "default-roles-";protected PersistenceService persistenceService;protected TimerService timerService;@@ -768,6 +769,9 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imClientRepresentation clientRepresentation = generateOpenRemoteClientRepresentation();createUpdateClient(tenant.getRealm(), clientRepresentation);+ // Add restricted realm role+ realmResource.roles().create(new RoleRepresentation(RESTRICTED_USER_REALM_ROLE, "Restricted access to assets", false));+Tenant createdTenant = convert(realmRepresentation, Tenant.class);publishModification(PersistenceEvent.Cause.CREATE, createdTenant);return createdTenant;@@ -962,9 +966,9 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider im}@Override- public boolean isRestrictedUser(String userId) {- UserConfiguration userConfiguration = persistenceService.doReturningTransaction(em -> em.find(UserConfiguration.class, userId));- return userConfiguration != null && userConfiguration.isRestricted();+ public boolean isRestrictedUser(AuthContext authContext) {++ return authContext.hasRealmRole(RESTRICTED_USER_REALM_ROLE);}@Override@@ -979,7 +983,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imreturn true;// Restricted users get nothing- if (isRestrictedUser(auth.getUserId()))+ if (isRestrictedUser(auth))return false;// User must have rolediff --git a/manager/src/main/java/org/openremote/manager/security/UserConfiguration.java b/manager/src/main/java/org/openremote/manager/security/UserConfiguration.javadeleted file mode 100644index e64eafe6e..000000000--- a/manager/src/main/java/org/openremote/manager/security/UserConfiguration.java+++ /dev/null@@ -1,70 +0,0 @@-/*- * Copyright 2016, OpenRemote Inc.- *- * See the CONTRIBUTORS.txt file in the distribution for a- * full listing of individual contributors.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <http://www.gnu.org/licenses/>.- */-package org.openremote.manager.security;--import javax.persistence.Column;-import javax.persistence.Entity;-import javax.persistence.Id;-import javax.persistence.Table;--@Entity-@Table(name = "USER_CONFIGURATION")-public class UserConfiguration {-- @Id- @Column(name = "USER_ID", length = 36)- protected String userId;-- @Column(name = "RESTRICTED", nullable = false)- protected boolean restricted;-- public UserConfiguration() {- }-- public UserConfiguration(String userId) {- this.userId = userId;- }-- public String getUserId() {- return userId;- }-- public UserConfiguration setUserId(String userId) {- this.userId = userId;- return this;- }-- public boolean isRestricted() {- return restricted;- }-- public UserConfiguration setRestricted(boolean restricted) {- this.restricted = restricted;- return this;- }-- @Override- public String toString() {- return getClass().getSimpleName() + "{" +- "userId=" + userId +- ", restricted=" + restricted +- '}';- }-}diff --git a/manager/src/main/java/org/openremote/manager/web/ManagerWebResource.java b/manager/src/main/java/org/openremote/manager/web/ManagerWebResource.javaindex 82df845f9..aaae7b010 100644--- a/manager/src/main/java/org/openremote/manager/web/ManagerWebResource.java+++ b/manager/src/main/java/org/openremote/manager/web/ManagerWebResource.java@@ -35,7 +35,7 @@ public class ManagerWebResource extends WebResource {}public boolean isRestrictedUser() {- return isAuthenticated() && identityService.getIdentityProvider().isRestrictedUser(getUserId());+ return isAuthenticated() && identityService.getIdentityProvider().isRestrictedUser(getAuthContext());}public Tenant getAuthenticatedTenant() {diff --git a/manager/src/main/resources/META-INF/services/org.openremote.model.EntityClassProvider b/manager/src/main/resources/META-INF/services/org.openremote.model.EntityClassProviderindex 2715860f6..e69de29bb 100644--- a/manager/src/main/resources/META-INF/services/org.openremote.model.EntityClassProvider+++ b/manager/src/main/resources/META-INF/services/org.openremote.model.EntityClassProvider@@ -1 +0,0 @@-org.openremote.manager.persistence.ManagerEntityClassProviderdiff --git a/manager/src/main/resources/org/openremote/manager/setup/database/V20211019_01__Schema.sql b/manager/src/main/resources/org/openremote/manager/setup/database/V20211019_01__Schema.sqlnew file mode 100644index 000000000..f1e6a335b--- /dev/null+++ b/manager/src/main/resources/org/openremote/manager/setup/database/V20211019_01__Schema.sql@@ -0,0 +1 @@+drop table USER_CONFIGURATION\ No newline at end of filediff --git a/model/src/main/java/org/openremote/model/Constants.java b/model/src/main/java/org/openremote/model/Constants.javaindex 2e15dbec3..44d544bce 100644--- a/model/src/main/java/org/openremote/model/Constants.java+++ b/model/src/main/java/org/openremote/model/Constants.java@@ -40,6 +40,7 @@ public interface Constants {String WRITE_ASSETS_ROLE = "write:assets";String WRITE_ATTRIBUTES_ROLE = "write:attributes";String WRITE_RULES_ROLE = "write:rules";+ String RESTRICTED_USER_REALM_ROLE = "restricted_user";String AUTH_CONTEXT = "AUTH_CONTEXT";int ACCESS_TOKEN_LIFESPAN_SECONDS = 60; // 1 minuteString PERSISTENCE_SEQUENCE_ID_GENERATOR = "SEQUENCE_ID_GENERATOR";diff --git a/test/src/main/java/org/openremote/test/setup/ManagerTestSetup.java b/test/src/main/java/org/openremote/test/setup/ManagerTestSetup.javaindex 75e7295ec..22afaf003 100644--- a/test/src/main/java/org/openremote/test/setup/ManagerTestSetup.java+++ b/test/src/main/java/org/openremote/test/setup/ManagerTestSetup.java@@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;import org.openremote.agent.protocol.simulator.SimulatorAgent;import org.openremote.agent.protocol.simulator.SimulatorAgentLink;import org.openremote.container.util.UniqueIdentifierGenerator;-import org.openremote.manager.security.UserConfiguration;import org.openremote.manager.setup.ManagerSetup;import org.openremote.model.Constants;import org.openremote.model.Container;@@ -573,13 +572,8 @@ public class ManagerTestSetup extends ManagerSetup {// ################################ Make users restricted ###################################- UserConfiguration testuser3Config = identityService.getUserConfiguration(keycloakTestSetup.testuser3Id);- testuser3Config.setRestricted(true);- testuser3Config = identityService.mergeUserConfiguration(testuser3Config);-- UserConfiguration buildingUserConfig = identityService.getUserConfiguration(keycloakTestSetup.buildingUserId);- testuser3Config.setRestricted(true);- buildingUserConfig = identityService.mergeUserConfiguration(buildingUserConfig);+ identityService.getIdentityProvider().updateUserRoles(tenantBuilding.getRealm(), keycloakTestSetup.testuser3Id, null, RESTRICTED_USER_REALM_ROLE);+ identityService.getIdentityProvider().updateUserRoles(tenantBuilding.getRealm(), keycloakTestSetup.buildingUserId, null, RESTRICTED_USER_REALM_ROLE);// ################################ Realm smartcity ###################################diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovyindex 5a3c38377..372ad15ec 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy@@ -1,5 +1,7 @@package org.openremote.test.assets+import org.keycloak.adapters.rotation.AdapterTokenVerifier+import org.openremote.container.security.keycloak.AccessTokenAuthContextimport org.openremote.container.timer.TimerServiceimport org.openremote.manager.security.ManagerIdentityServiceimport org.openremote.manager.setup.SetupService@@ -28,7 +30,7 @@ class AssetUserLinkingTest extends Specification implements ManagerContainerTraidef keycloakTestSetup = container.getService(SetupService.class).getTaskOfType(KeycloakTestSetup.class)and: "an authenticated admin user"- def accessToken = authenticate(+ def accessTokenString = authenticate(container,MASTER_REALM,KEYCLOAK_CLIENT_ID,@@ -37,14 +39,26 @@ class AssetUserLinkingTest extends Specification implements ManagerContainerTrai).tokenand: "the asset resource"- def assetResource = getClientApiTarget(serverUri(serverPort), MASTER_REALM, accessToken).proxy(AssetResource.class)-+ def assetResource = getClientApiTarget(serverUri(serverPort), MASTER_REALM, accessTokenString).proxy(AssetResource.class)/* ############################################## READ ####################################### */+ and: "user access tokens"+ def testUserAccessToken = authenticate(container, MASTER_REALM, KEYCLOAK_CLIENT_ID, "testuser1", "testuser1").token+ def accessToken = AdapterTokenVerifier.verifyToken(testUserAccessToken, keycloakTestSetup.getKeycloakProvider().getKeycloakDeployment(MASTER_REALM, KEYCLOAK_CLIENT_ID))+ def testUser1Token = new AccessTokenAuthContext(MASTER_REALM, accessToken)++ testUserAccessToken = authenticate(container, keycloakTestSetup.tenantBuilding.realm, KEYCLOAK_CLIENT_ID, "testuser2", "testuser2").token+ accessToken = AdapterTokenVerifier.verifyToken(testUserAccessToken, keycloakTestSetup.getKeycloakProvider().getKeycloakDeployment(keycloakTestSetup.tenantBuilding.realm, KEYCLOAK_CLIENT_ID))+ def testUser2Token = new AccessTokenAuthContext(keycloakTestSetup.tenantBuilding.realm, accessToken)++ testUserAccessToken = authenticate(container, keycloakTestSetup.tenantBuilding.realm, KEYCLOAK_CLIENT_ID, "testuser3", "testuser3").token+ accessToken = AdapterTokenVerifier.verifyToken(testUserAccessToken, keycloakTestSetup.getKeycloakProvider().getKeycloakDeployment(keycloakTestSetup.tenantBuilding.realm, KEYCLOAK_CLIENT_ID))+ def testUser3Token = new AccessTokenAuthContext(keycloakTestSetup.tenantBuilding.realm, accessToken)+expect: "some users to be restricted"- !identityService.getIdentityProvider().isRestrictedUser(keycloakTestSetup.testuser1Id)- !identityService.getIdentityProvider().isRestrictedUser(keycloakTestSetup.testuser2Id)- identityService.getIdentityProvider().isRestrictedUser(keycloakTestSetup.testuser3Id)+ !identityService.getIdentityProvider().isRestrictedUser(testUser1Token)+ !identityService.getIdentityProvider().isRestrictedUser(testUser2Token)+ identityService.getIdentityProvider().isRestrictedUser(testUser3Token)when: "all user assets are retrieved of a realm"def userAssets = assetResource.getUserAssetLinks(null, keycloakTestSetup.tenantBuilding.realm, null, null)