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
UI updates: Added reset password request to account page when email as username is true (#1887)
Michael Rademaker25c021402730
diff --git a/manager/src/main/java/org/openremote/manager/security/ManagerBasicIdentityProvider.java b/manager/src/main/java/org/openremote/manager/security/ManagerBasicIdentityProvider.javaindex 19b503d6e..625053258 100644--- a/manager/src/main/java/org/openremote/manager/security/ManagerBasicIdentityProvider.java+++ b/manager/src/main/java/org/openremote/manager/security/ManagerBasicIdentityProvider.java@@ -141,6 +141,11 @@ public class ManagerBasicIdentityProvider extends BasicIdentityProvider implemen});}+ @Override+ public void requestPasswordReset(String realm, String userId) {+ throw new UnsupportedOperationException("This provider does not support password reset");+ }+@Overridepublic void resetPassword(String realm, String userId, Credential credential) {throw new UnsupportedOperationException("This provider does not support password reset");diff --git a/manager/src/main/java/org/openremote/manager/security/ManagerIdentityProvider.java b/manager/src/main/java/org/openremote/manager/security/ManagerIdentityProvider.javaindex 98f3ddaca..d63fdadbd 100644--- a/manager/src/main/java/org/openremote/manager/security/ManagerIdentityProvider.java+++ b/manager/src/main/java/org/openremote/manager/security/ManagerIdentityProvider.java@@ -58,6 +58,8 @@ public interface ManagerIdentityProvider extends IdentityProvider {void deleteUser(String realm, String userId);+ void requestPasswordReset(String realm, String userId);+void resetPassword(String realm, String userId, Credential credential);String resetSecret(String realm, String userId, String secret);@@ -303,10 +305,10 @@ public interface ManagerIdentityProvider extends IdentityProvider {static User getUserByUsernameFromDb(PersistenceService persistenceService, String realm, String username) {return persistenceService.doReturningTransaction(em -> {List<User> result =- em.createQuery("select u from User u where u.realm = :realm and u.username = :username", User.class)- .setParameter("realm", realm)- .setParameter("username", username)- .getResultList();+ em.createQuery("select u from User u where u.realm = :realm and u.username = :username", User.class)+ .setParameter("realm", realm)+ .setParameter("username", username)+ .getResultList();return result.size() > 0 ? result.get(0) : null;});}@@ -314,9 +316,9 @@ public interface ManagerIdentityProvider extends IdentityProvider {static User getUserByIdFromDb(PersistenceService persistenceService, String userId) {return persistenceService.doReturningTransaction(em -> {List<User> result =- em.createQuery("select u from User u where u.id = :userId", User.class)- .setParameter("userId", userId)- .getResultList();+ em.createQuery("select u from User u where u.id = :userId", User.class)+ .setParameter("userId", userId)+ .getResultList();return result.size() > 0 ? result.get(0) : null;});}@@ -326,17 +328,17 @@ public interface ManagerIdentityProvider extends IdentityProvider {return persistenceService.doReturningTransaction(em -> {Map<String, String> usernameIdMap = em.createQuery(- "select u.username, u.id from User u join Realm r on r.id = u.realmId where u.username in :usernames and r.name = :realm", Tuple.class)- .setParameter("usernames", CIUsernames)- .setParameter("realm", realm)- .getResultList()- .stream()- .collect(- Collectors.toMap(- tuple -> (String) tuple.get(0),- tuple -> (String) tuple.get(1)- )- );+ "select u.username, u.id from User u join Realm r on r.id = u.realmId where u.username in :usernames and r.name = :realm", Tuple.class)+ .setParameter("usernames", CIUsernames)+ .setParameter("realm", realm)+ .getResultList()+ .stream()+ .collect(+ Collectors.toMap(+ tuple -> (String) tuple.get(0),+ tuple -> (String) tuple.get(1)+ )+ );return CIUsernames.stream().map(usernameIdMap::get).collect(Collectors.toList());});@@ -346,8 +348,10 @@ public interface ManagerIdentityProvider extends IdentityProvider {static Realm[] getRealmsFromDb(PersistenceService persistenceService) {return persistenceService.doReturningTransaction(entityManager -> {List<Realm> realms = (List<Realm>) entityManager.createNativeQuery(- "select *, (select ra.VALUE from PUBLIC.REALM_ATTRIBUTE ra where ra.REALM_ID = r.ID and ra.name = 'displayName') as displayName from public.realm r where r.not_before is null or r.not_before = 0 or r.not_before <= extract('epoch' from now())"- , Realm.class).getResultList();+ "select *, " ++ "(select ra.VALUE from PUBLIC.REALM_ATTRIBUTE ra where ra.REALM_ID = r.ID and ra.name = 'displayName') as displayName " ++ "from public.realm r where r.not_before is null or r.not_before = 0 or r.not_before <= extract('epoch' from now())"+ , Realm.class).getResultList();// Make sure the master realm is always on toprealms.sort((o1, o2) -> {@@ -364,9 +368,9 @@ public interface ManagerIdentityProvider extends IdentityProvider {static Realm getRealmFromDb(PersistenceService persistenceService, String name) {return persistenceService.doReturningTransaction(em -> em- .createQuery("select r from Realm r where r.name = :realm", Realm.class)- .setParameter("realm", name)- .getSingleResult()+ .createQuery("select r from Realm r where r.name = :realm", Realm.class)+ .setParameter("realm", name)+ .getSingleResult());}@@ -374,8 +378,8 @@ public interface ManagerIdentityProvider extends IdentityProvider {return persistenceService.doReturningTransaction(em -> {long count = (long) em.createNativeQuery(- "select count(*) from public.realm r where r.name = :realm and r.enabled = true and (r.not_before is null or r.not_before = 0 or r.not_before <= extract('epoch' from now()))",- Long.class).setParameter("realm", realm).getSingleResult();+ "select count(*) from public.realm r where r.name = :realm and r.enabled = true and (r.not_before is null or r.not_before = 0 or r.not_before <= extract('epoch' from now()))",+ Long.class).setParameter("realm", realm).getSingleResult();return count > 0;});diff --git a/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java b/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.javaindex 6cc815b18..bd4c5e4a0 100644--- a/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java+++ b/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java@@ -19,6 +19,9 @@*/package org.openremote.manager.security;+import com.google.common.cache.Cache;+import com.google.common.cache.CacheBuilder;+import com.google.common.cache.CacheLoader;import io.undertow.util.Headers;import jakarta.persistence.Query;import jakarta.validation.constraints.NotNull;@@ -31,6 +34,7 @@ import org.keycloak.admin.client.resource.RealmResource;import org.keycloak.admin.client.resource.UserResource;import org.keycloak.admin.client.resource.*;import org.keycloak.common.enums.SslRequired;+import org.keycloak.models.UserModel;import org.keycloak.representations.idm.*;import org.openremote.container.message.MessageBrokerService;import org.openremote.container.persistence.PersistenceService;@@ -65,8 +69,8 @@ import java.nio.charset.StandardCharsets;import java.nio.file.Files;import java.nio.file.Path;import java.nio.file.StandardOpenOption;+import java.time.Duration;import java.util.*;-import java.util.concurrent.ConcurrentHashMap;import java.util.function.BiFunction;import java.util.function.Supplier;import java.util.logging.Level;@@ -93,6 +97,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider impublic static final String OR_KEYCLOAK_PUBLIC_URI = "OR_KEYCLOAK_PUBLIC_URI";public static final String OR_KEYCLOAK_PUBLIC_URI_DEFAULT = "/auth";public static final String OR_KEYCLOAK_ENABLE_DIRECT_ACCESS_GRANT = "OR_KEYCLOAK_ENABLE_DIRECT_ACCESS_GRANT";+ public static final int REALM_CACHE_EXPIRY_MINS = 10;public static final List<String> BUILT_IN_REALM_ROLES = List.of("admin","create-realm",@@ -109,13 +114,18 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider improtected Container container;protected String frontendURI;protected List<String> validRedirectUris;- protected Map<String, Realm> realmCache = new ConcurrentHashMap<>();+ protected Cache<String, Realm> realmCache;@Overridepublic void init(Container container) {super.init(container);this.container = container;+ realmCache = CacheBuilder.newBuilder()+ .maximumSize(100)+ .expireAfterWrite(Duration.ofMinutes(container.isDevMode() ? 0 : REALM_CACHE_EXPIRY_MINS))+ .build();+String keycloakPublicUri = getString(container.getConfig(), OR_KEYCLOAK_PUBLIC_URI, OR_KEYCLOAK_PUBLIC_URI_DEFAULT);try {URIBuilder uriBuilder = new URIBuilder(keycloakPublicUri);@@ -290,7 +300,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imClientRepresentation clientRepresentation;UserRepresentation userRepresentation;- if(existingUser != null && !allowUpdate) {+ if (existingUser != null && !allowUpdate) {String msg = "Attempt to create user but it already exists: User=" + user;LOG.warning(msg);throw new ForbiddenException(msg);@@ -379,7 +389,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imthrow new BadRequestException("Failed to create user: User=" + user);}String[] locationArr = location.split("/");- String userId = locationArr.length > 0 ? locationArr[locationArr.length-1] : null;+ String userId = locationArr.length > 0 ? locationArr[locationArr.length - 1] : null;userRepresentation = realmResource.users().get(userId).toRepresentation();}}@@ -454,6 +464,19 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imnull);}+ @Override+ public void requestPasswordReset(String realm, String userId) {+ getRealms(realmsResource -> {+ RealmResource realmResource = realmsResource.realm(realm);+ if (realmResource.toRepresentation().getSmtpServer().isEmpty())+ throw new IllegalStateException("SMTP server is not configured for realm: " + realm);+ realmResource.users().get(userId).executeActionsEmail(+ Collections.singletonList(UserModel.RequiredAction.UPDATE_PASSWORD.toString())+ );+ return null;+ });+ }+@Overridepublic void resetPassword(String realm, String userId, Credential credential) {getRealms(realmsResource -> {@@ -641,15 +664,15 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imreturn getRealms(realmsResource -> {RealmResource realmResource = realmsResource.realm(realm);RoleMappingResource roleMappingResource = realmResource.users().get(userId).roles();- return roleMappingResource.realmLevel().listEffective()- .stream()- .filter(rr -> (MASTER_REALM.equals(realm) && SUPER_USER_REALM_ROLE.equals(rr.getName())) || !isBuiltInRealmRole(rr.getName()))- .map(RoleRepresentation::getName).toArray(String[]::new);+ return roleMappingResource.realmLevel().listEffective()+ .stream()+ .filter(rr -> (MASTER_REALM.equals(realm) && SUPER_USER_REALM_ROLE.equals(rr.getName())) || !isBuiltInRealmRole(rr.getName()))+ .map(RoleRepresentation::getName).toArray(String[]::new);});}@Override- public void updateUserClientRoles(@NotNull String realm, @NotNull String userId, @NotNull String client, String...roles) {+ public void updateUserClientRoles(@NotNull String realm, @NotNull String userId, @NotNull String client, String... roles) {getRealms(realmsResource -> {RealmResource realmResource = realmsResource.realm(realm);UserRepresentation user = realmResource.users().get(userId).toRepresentation();@@ -672,30 +695,30 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider im// Delete any that are not assigned and add all that are assignedavailableRoles.stream()- .collect(Collectors.partitioningBy(rr -> assignedRoles.contains(rr.getName())))- .forEach((isAssigned, realmRoles) -> {- if (isAssigned) {- // Assigned roles- if (!realmRoles.isEmpty()) {- roleMappingResource.clientLevel(clientRepresentation.getId()).add(realmRoles.stream().map(v -> {- RoleRepresentation rr = new RoleRepresentation();- rr.setId(v.getId());- rr.setName(v.getName());- return rr;- }).toList());- }- } else {- // Unassigned roles- if (!realmRoles.isEmpty()) {- roleMappingResource.clientLevel(clientRepresentation.getId()).remove(realmRoles.stream().map(v -> {- RoleRepresentation rr = new RoleRepresentation();- rr.setId(v.getId());- rr.setName(v.getName());- return rr;- }).toList());- }+ .collect(Collectors.partitioningBy(rr -> assignedRoles.contains(rr.getName())))+ .forEach((isAssigned, realmRoles) -> {+ if (isAssigned) {+ // Assigned roles+ if (!realmRoles.isEmpty()) {+ roleMappingResource.clientLevel(clientRepresentation.getId()).add(realmRoles.stream().map(v -> {+ RoleRepresentation rr = new RoleRepresentation();+ rr.setId(v.getId());+ rr.setName(v.getName());+ return rr;+ }).toList());}- });+ } else {+ // Unassigned roles+ if (!realmRoles.isEmpty()) {+ roleMappingResource.clientLevel(clientRepresentation.getId()).remove(realmRoles.stream().map(v -> {+ RoleRepresentation rr = new RoleRepresentation();+ rr.setId(v.getId());+ rr.setName(v.getName());+ return rr;+ }).toList());+ }+ }+ });return null;});}@@ -770,22 +793,28 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider im@Overridepublic Realm getRealm(String name) {// This gets hit a lot for event authorisation so caching added- return realmCache.computeIfAbsent(name, k -> {- try {- Realm realm = ManagerIdentityProvider.getRealmFromDb(persistenceService, name);- // Filter out built in roles- realm.setRealmRoles(- realm.getRealmRoles()- .stream()- .filter(rr -> (MASTER_REALM.equals(name) && SUPER_USER_REALM_ROLE.equals(rr.getName())) || !isBuiltInRealmRole(rr.getName()))- .collect(Collectors.toSet())- );- return realm;- } catch (Exception ex) {- LOG.log(Level.INFO, "Failed to get realm by name: " + name, ex);- }- return null;- });+ try {+ return realmCache.get(name, () -> {+ try {+ Realm realm = ManagerIdentityProvider.getRealmFromDb(persistenceService, name);+ // Filter out built in roles+ realm.setRealmRoles(+ realm.getRealmRoles()+ .stream()+ .filter(rr -> (MASTER_REALM.equals(name) && SUPER_USER_REALM_ROLE.equals(rr.getName())) || !isBuiltInRealmRole(rr.getName()))+ .collect(Collectors.toSet())+ );+ return realm;+ } catch (Exception ex) {+ LOG.log(Level.INFO, "Failed to get realm by name: " + name, ex);+ }+ return null;+ });+ } catch (CacheLoader.InvalidCacheLoadException ignored) {+ } catch (Exception e) {+ LOG.log(Level.INFO, "Failed to get realm by name: " + name, e);+ }+ return null;}@Override@@ -800,9 +829,9 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imRealmResource realmResource = realmsResource.realm(realm.getName());RealmRepresentation realmRepresentation = realmResource.toRepresentation();Set<RoleRepresentation> existingRealmRoles = realmResource.roles().list()- .stream()- .filter(rr -> !isBuiltInRealmRole(rr.getName()))- .collect(Collectors.toSet());+ .stream()+ .filter(rr -> !isBuiltInRealmRole(rr.getName()))+ .collect(Collectors.toSet());if (realmRepresentation == null) {throw new IllegalStateException("Realm does not exist: " + realm.getName());@@ -813,8 +842,8 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imexistingRealm.setName(realmRepresentation.getRealm());// Inject roles as don't exist in realmRepresentationexistingRealm.setRealmRoles(existingRealmRoles.stream()- .map(err -> new RealmRole(err.getId(), err.getName(), err.getDescription()))- .collect(Collectors.toSet()));+ .map(err -> new RealmRole(err.getId(), err.getName(), err.getDescription()))+ .collect(Collectors.toSet()));// Realm only has a subset of realm representation so overlay on actual realm representationrealmRepresentation.setDisplayName(realm.getDisplayName());@@ -835,12 +864,12 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imconfigureRealm(realmRepresentation);realmResource.update(realmRepresentation);- realmCache.remove(realm.getName());+ realmCache.invalidate(realm.getName());Set<RealmRole> realmRoles = (realm.getRealmRoles() != null ? realm.getRealmRoles() : new HashSet<RealmRole>())- .stream()- .filter(rr -> !isBuiltInRealmRole(rr.getName()))- .collect(Collectors.toSet());+ .stream()+ .filter(rr -> !isBuiltInRealmRole(rr.getName()))+ .collect(Collectors.toSet());realmRoles = new HashSet<>(realmRoles);realmRoles.addAll(Realm.DEFAULT_REALM_ROLES);@@ -848,7 +877,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imSet<RealmRole> finalRealmRoles = realmRoles;existingRealmRoles.forEach(existingRealmRole -> {if (finalRealmRoles.stream()- .noneMatch(realmRole -> realmRole.getName().equals(existingRealmRole.getName()))) {+ .noneMatch(realmRole -> realmRole.getName().equals(existingRealmRole.getName()))) {realmResource.roles().deleteRole(existingRealmRole.getName());}});@@ -856,7 +885,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider im// Create new rolesrealmRoles.forEach(realmRole -> {if (existingRealmRoles.stream()- .noneMatch(existingRealmRole -> existingRealmRole.getName().equals(realmRole.getName()))) {+ .noneMatch(existingRealmRole -> existingRealmRole.getName().equals(realmRole.getName()))) {realmResource.roles().create(new RoleRepresentation(realmRole.getName(), realmRole.getDescription(), false));}});@@ -891,9 +920,9 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider im// Create realm roles insertingSet<RealmRole> realmRoles = (realm.getRealmRoles() != null ? realm.getRealmRoles() : new HashSet<RealmRole>())- .stream()- .filter(rr -> !isBuiltInRealmRole(rr.getName()))- .collect(Collectors.toSet());+ .stream()+ .filter(rr -> !isBuiltInRealmRole(rr.getName()))+ .collect(Collectors.toSet());realmRoles = new HashSet<>(realmRoles);realmRoles.addAll(Realm.DEFAULT_REALM_ROLES);realmRoles.forEach(realmRole -> {@@ -927,7 +956,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imthrow new NotFoundException("Realm does not exist: " + realmName);}- realmCache.remove(realmName);+ realmCache.invalidate(realmName);persistenceService.doTransaction(entityManager -> {// Delete gateway connections@@ -1010,37 +1039,37 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imreturn getRealms(realmsResource ->withClientResource(realm, client.getClientId(), realmsResource, (clientRepresentation, clientResource) -> {- clientResource.update(client);- return client;- },- () -> {- ClientsResource clientsResource = realmsResource.realm(realm).clients();- Response response = clientsResource.create(client);- response.close();- if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {- LOG.fine("Failed to create client response=" + response.getStatusInfo().getStatusCode() + ": " + client);- return null;- }+ clientResource.update(client);+ return client;+ },+ () -> {+ ClientsResource clientsResource = realmsResource.realm(realm).clients();+ Response response = clientsResource.create(client);+ response.close();+ if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {+ LOG.fine("Failed to create client response=" + response.getStatusInfo().getStatusCode() + ": " + client);+ return null;+ }- ClientRepresentation newClient = clientsResource.findByClientId(client.getClientId()).getFirst();- ClientResource clientResource = clientsResource.get(newClient.getId());- addDefaultRoles(clientResource.roles());- return newClient;- }));+ ClientRepresentation newClient = clientsResource.findByClientId(client.getClientId()).getFirst();+ ClientResource clientResource = clientsResource.get(newClient.getId());+ addDefaultRoles(clientResource.roles());+ return newClient;+ }));}/*** Imports the identity provider configuration using the given import data. This simplifies configuring an OIDC or SAML* identity provider from which some of the configuration parameters can be imported from the identity provider itself.*- * @param realm the realm used for importing the identity provider configuration.+ * @param realm the realm used for importing the identity provider configuration.* @param importData contains the details required for importing the identity provider configuration.- * E.g. the following values can be used:- * <ul><li>{@code fromUrl}: The URL used for importing the configuration parameters</li>- * <li>{@code providerId}: The identity provider ({@code oidc} or {@code saml}) to import the configuration for.</li></ul>+ * E.g. the following values can be used:+ * <ul><li>{@code fromUrl}: The URL used for importing the configuration parameters</li>+ * <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, 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()) {@@ -1090,7 +1119,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider im} else {try (Response response = idpResource.addMapper(mapper)) {if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {- throw new IllegalStateException("Failed to create identity provider mapper '" + mapperName + "' response=" + response.getStatusInfo().getStatusCode() + ": " + response.getStatusInfo().getReasonPhrase());+ throw new IllegalStateException("Failed to create identity provider mapper '" + mapperName + "' response=" + response.getStatusInfo().getStatusCode() + ": " + response.getStatusInfo().getReasonPhrase());}}}@@ -1230,13 +1259,13 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider imString themeName = getString(container.getConfig(), realmRepresentation.getRealm().toUpperCase(Locale.ROOT) + REALM_KEYCLOAK_THEME_SUFFIX, getString(container.getConfig(), DEFAULT_REALM_KEYCLOAK_THEME, DEFAULT_REALM_KEYCLOAK_THEME_DEFAULT));- if(TextUtil.isNullOrEmpty(realmRepresentation.getLoginTheme())) {+ if (TextUtil.isNullOrEmpty(realmRepresentation.getLoginTheme())) {realmRepresentation.setLoginTheme(themeName);}- if(TextUtil.isNullOrEmpty(realmRepresentation.getAccountTheme())) {+ if (TextUtil.isNullOrEmpty(realmRepresentation.getAccountTheme())) {realmRepresentation.setAccountTheme(themeName);}- if(TextUtil.isNullOrEmpty(realmRepresentation.getEmailTheme())) {+ if (TextUtil.isNullOrEmpty(realmRepresentation.getEmailTheme())) {realmRepresentation.setEmailTheme(themeName);}@@ -1274,12 +1303,12 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider im}if (container.isDevMode()) {- headers.computeIfPresent("contentSecurityPolicy", (hdrName, hdrValue) -> "frame-src *; frame-ancestors *; object-src 'none'");+ headers.computeIfPresent("contentSecurityPolicy", (hdrName, hdrValue) -> "frame-src *; frame-ancestors *; object-src 'none'");} else {String allowedOriginsStr = String.join(" ", WebService.getAllowedOrigins(container));if (!TextUtil.isNullOrEmpty(allowedOriginsStr)) {headers.compute("contentSecurityPolicy", (hdrName, hdrValue) ->- "frame-src 'self' " ++ "frame-src 'self' " +allowedOriginsStr.replace(';', ' ') +"; frame-ancestors 'self' " +allowedOriginsStr.replace(';', ' ') +diff --git a/manager/src/main/java/org/openremote/manager/security/UserResourceImpl.java b/manager/src/main/java/org/openremote/manager/security/UserResourceImpl.javaindex b49a508e5..cfb6b3521 100644--- a/manager/src/main/java/org/openremote/manager/security/UserResourceImpl.java+++ b/manager/src/main/java/org/openremote/manager/security/UserResourceImpl.java@@ -35,6 +35,7 @@ import jakarta.ws.rs.*;import org.openremote.model.util.TextUtil;import java.util.*;+import java.util.AbstractMap;import static org.openremote.model.Constants.KEYCLOAK_CLIENT_ID;import static org.openremote.model.Constants.MASTER_REALM;@@ -55,7 +56,7 @@ public class UserResourceImpl extends ManagerWebResource implements UserResourceboolean isRestricted = !isAdmin && authContext.hasResourceRole(ClientRole.READ_USERS.getValue(), Constants.KEYCLOAK_CLIENT_ID);if (!isAdmin && !isRestricted) {- throw new ForbiddenException("Insufficient permissions to read users");+ throw new ForbiddenException("Insufficient permissions to read users");}if (query == null) {@@ -125,6 +126,7 @@ public class UserResourceImpl extends ManagerWebResource implements UserResourcepublic User update(RequestParams requestParams, String realm, User user) {throwIfIllegalMasterAdminUserMutation(requestParams, realm, user);+ throwIfNotSameRealm(realm, user.getId());try {return identityService.getIdentityProvider().createUpdateUser(realm, user, null, true);@@ -137,6 +139,34 @@ public class UserResourceImpl extends ManagerWebResource implements UserResource}}+ @Override+ public User updateCurrent(RequestParams requestParams, User user) {+ try {+ Map.Entry<String, String> authInfo = getCurrentUserAuthInfo();+ String userId = authInfo.getKey();+ String realm = authInfo.getValue();++ // Ensure the user ID in the provided user object matches the current user+ if (user.getId() != null && !user.getId().equals(userId)) {+ throw new ForbiddenException("Cannot update a different user's information");+ }++ // Set the correct ID if not already set+ if (user.getId() == null) {+ user.setId(userId);+ }++ // Perform the update+ return identityService.getIdentityProvider().createUpdateUser(realm, user, null, true);+ } catch (ClientErrorException ex) {+ throw new WebApplicationException(ex.getCause(), ex.getResponse().getStatus());+ } catch (WebApplicationException ex) {+ throw ex;+ } catch (Exception ex) {+ throw new WebApplicationException(ex);+ }+ }+@Overridepublic User create(RequestParams requestParams, String realm, User user) {@@ -167,8 +197,55 @@ public class UserResourceImpl extends ManagerWebResource implements UserResource}@Override- public void resetPassword(@BeanParam RequestParams requestParams, String realm, String userId, Credential credential) {+ public void requestPasswordReset(RequestParams requestParams, String realm, String userId) {+ throwIfNotSameRealm(realm, userId);++ try {+ identityService.getIdentityProvider().requestPasswordReset(realm, userId);+ } catch (ClientErrorException ex) {+ throw new WebApplicationException(ex.getCause(), ex.getResponse().getStatus());+ } catch (Exception ex) {+ throw new WebApplicationException(ex);+ }+ }++ @Override+ public void requestPasswordResetCurrent(RequestParams requestParams) {+ try {+ Map.Entry<String, String> authInfo = getCurrentUserAuthInfo();+ String userId = authInfo.getKey();+ String realm = authInfo.getValue();++ // Call the identity provider to request password reset for the current user+ identityService.getIdentityProvider().requestPasswordReset(realm, userId);+ } catch (ClientErrorException ex) {+ throw new WebApplicationException(ex.getCause(), ex.getResponse().getStatus());+ } catch (Exception ex) {+ throw new WebApplicationException(ex);+ }+ }++ @Override+ public void updatePassword(@BeanParam RequestParams requestParams, String realm, String userId, Credential credential) {+ throwIfNotSameRealm(realm, userId);++ try {+ identityService.getIdentityProvider().resetPassword(realm, userId, credential);+ } catch (ClientErrorException ex) {+ throw new WebApplicationException(ex.getCause(), ex.getResponse().getStatus());+ } catch (Exception ex) {+ throw new WebApplicationException(ex);+ }+ }++ @Override+ public void updatePasswordCurrent(@BeanParam RequestParams requestParams, Credential credential) {try {+ Map.Entry<String, String> authInfo = getCurrentUserAuthInfo();+ String userId = authInfo.getKey();+ String realm = authInfo.getValue();++ // Call the identity provider to reset the passwordidentityService.getIdentityProvider().resetPassword(realm, userId, credential);} catch (ClientErrorException ex) {throw new WebApplicationException(ex.getCause(), ex.getResponse().getStatus());@@ -235,7 +312,7 @@ public class UserResourceImpl extends ManagerWebResource implements UserResourcetry {return identityService.getIdentityProvider().getUserRealmRoles(- realm, userId+ realm, userId);} catch (ClientErrorException ex) {throw new WebApplicationException(ex.getCause(), ex.getResponse().getStatus());@@ -264,9 +341,9 @@ public class UserResourceImpl extends ManagerWebResource implements UserResourcepublic void updateUserRealmRoles(RequestParams requestParams, String realm, String userId, String[] roles) {try {identityService.getIdentityProvider().updateUserRealmRoles(- realm,- userId,- roles);+ realm,+ userId,+ roles);} catch (ClientErrorException ex) {ex.printStackTrace(System.out);throw new WebApplicationException(ex.getCause(), ex.getResponse().getStatus());@@ -311,12 +388,12 @@ public class UserResourceImpl extends ManagerWebResource implements UserResource@Overridepublic void updateCurrentUserLocale(RequestParams requestParams, String locale) {String parsed = locale.replaceAll("\"", "");- if(TextUtil.isNullOrEmpty(parsed)) {+ if (TextUtil.isNullOrEmpty(parsed)) {throw new BadRequestException("Locale cannot be empty");}User user = getCurrent(requestParams);- if(user == null) {+ if (user == null) {throw new NotFoundException("User not found");}@@ -371,5 +448,39 @@ public class UserResourceImpl extends ManagerWebResource implements UserResourcethrow new NotAllowedException("The master realm admin user cannot be disabled");}}-}+ protected void throwIfNotSameRealm(String realm, String userId) throws WebApplicationException {+ if (isSuperUser()) {+ return;+ }++ Map.Entry<String, String> authInfo = getCurrentUserAuthInfo();+ String currentUserId = authInfo.getKey();+ String currentUserRealm = authInfo.getValue();++ if (!currentUserRealm.equals(realm)) {+ throw new NotAllowedException("Cannot mutate a user in a different realm");+ }++ if (!currentUserId.equals(userId) && !hasResourceRole(Constants.WRITE_ADMIN_ROLE, Constants.KEYCLOAK_CLIENT_ID)) {+ throw new NotAllowedException("Not allowed to mutate another user");+ }+ }++ protected Map.Entry<String, String> getCurrentUserAuthInfo() {+ // Get the current authenticated user information+ AuthContext authContext = getAuthContext();+ if (authContext == null) {+ throw new NotAuthorizedException("Not authenticated");+ }++ String userId = authContext.getUserId();+ String realm = authContext.getAuthenticatedRealmName();++ if (userId == null || realm == null) {+ throw new NotAuthorizedException("User ID or realm not available");+ }++ return new AbstractMap.SimpleEntry<>(userId, realm);+ }+}diff --git a/model/src/main/java/org/openremote/model/security/Realm.java b/model/src/main/java/org/openremote/model/security/Realm.javaindex d8aba8db8..928b90ac6 100644--- a/model/src/main/java/org/openremote/model/security/Realm.java+++ b/model/src/main/java/org/openremote/model/security/Realm.java@@ -19,7 +19,6 @@*/package org.openremote.model.security;-import com.fasterxml.jackson.annotation.JsonIgnore;import com.fasterxml.jackson.core.JsonParser;import com.fasterxml.jackson.databind.*;import com.fasterxml.jackson.databind.annotation.JsonDeserialize;@@ -33,10 +32,8 @@ import jakarta.validation.constraints.Size;import org.openremote.model.persistence.PasswordPolicyConverter;import java.io.IOException;-import java.lang.reflect.Field;import java.util.*;-import static org.openremote.model.Constants.MASTER_REALM;import static org.openremote.model.Constants.RESTRICTED_USER_REALM_ROLE;/**diff --git a/model/src/main/java/org/openremote/model/security/UserResource.java b/model/src/main/java/org/openremote/model/security/UserResource.javaindex 0851fba6e..4afd26669 100644--- a/model/src/main/java/org/openremote/model/security/UserResource.java+++ b/model/src/main/java/org/openremote/model/security/UserResource.java@@ -87,6 +87,14 @@ public interface UserResource {@Operation(operationId = "updateUser", summary = "Update a user in a realm")User update(@BeanParam RequestParams requestParams, @PathParam("realm") String realm, @Valid User user);+ @PUT+ @Path("update")+ @Consumes(APPLICATION_JSON)+ @Produces(APPLICATION_JSON)+ @RolesAllowed(Constants.WRITE_USER_ROLE)+ @Operation(operationId = "updateSelf", summary = "Update the currently authenticated user")+ User updateCurrent(@BeanParam RequestParams requestParams, @Valid User user);+@POST@Path("{realm}/users")@Consumes(APPLICATION_JSON)@@ -101,13 +109,37 @@ public interface UserResource {@Operation(operationId = "deleteUser", summary = "Delete a user from a realm")void delete(@BeanParam RequestParams requestParams, @PathParam("realm") String realm, @PathParam("userId") String userId);+ @PUT+ @Path("{realm}/request-password-reset/{userId}")+ @Consumes(APPLICATION_JSON)+ @Produces(APPLICATION_JSON)+ @RolesAllowed(Constants.WRITE_ADMIN_ROLE)+ @Operation(operationId = "requestUserPasswordReset", summary = "Request a password reset for a user in a realm")+ void requestPasswordReset(@BeanParam RequestParams requestParams, @PathParam("realm") String realm, @PathParam("userId") String userId);++ @PUT+ @Path("request-password-reset")+ @Consumes(APPLICATION_JSON)+ @Produces(APPLICATION_JSON)+ @RolesAllowed(Constants.WRITE_USER_ROLE)+ @Operation(operationId = "requestPasswordReset", summary = "Request a password reset for the currently authenticated user")+ void requestPasswordResetCurrent(@BeanParam RequestParams requestParams);+@PUT@Path("{realm}/reset-password/{userId}")@Consumes(APPLICATION_JSON)@Produces(APPLICATION_JSON)@RolesAllowed(Constants.WRITE_ADMIN_ROLE)- @Operation(operationId = "resetPassword", summary = "Reset the password for a user in a realm")- void resetPassword(@BeanParam RequestParams requestParams, @PathParam("realm") String realm, @PathParam("userId") String userId, Credential credential);+ @Operation(operationId = "updatePassword", summary = "Update the password for a user in a realm")+ void updatePassword(@BeanParam RequestParams requestParams, @PathParam("realm") String realm, @PathParam("userId") String userId, Credential credential);++ @PUT+ @Path("reset-password")+ @Consumes(APPLICATION_JSON)+ @Produces(APPLICATION_JSON)+ @RolesAllowed(Constants.WRITE_USER_ROLE)+ @Operation(operationId = "updateOwnPassword", summary = "Update the password for the currently authenticated user")+ void updatePasswordCurrent(@BeanParam RequestParams requestParams, Credential credential);@GET@Path("{realm}/reset-secret/{userId}")diff --git a/setup/src/integration/java/org/openremote/setup/integration/KeycloakTestSetup.java b/setup/src/integration/java/org/openremote/setup/integration/KeycloakTestSetup.javaindex 56a8e8927..cefe15f54 100644--- a/setup/src/integration/java/org/openremote/setup/integration/KeycloakTestSetup.java+++ b/setup/src/integration/java/org/openremote/setup/integration/KeycloakTestSetup.java@@ -30,7 +30,9 @@ import org.openremote.model.security.ClientRole;import org.openremote.model.security.Realm;import org.openremote.model.security.User;+import java.util.ArrayList;import java.util.Arrays;+import java.util.List;import java.util.logging.Logger;import java.util.stream.Stream;@@ -57,6 +59,7 @@ public class KeycloakTestSetup extends AbstractKeycloakSetup {public String testuser1Id;public String testuser2Id;public String testuser3Id;+ public String testuser4Id;public String smartCityUserId;public String buildingUserId;public Realm realmMaster;@@ -66,6 +69,7 @@ public class KeycloakTestSetup extends AbstractKeycloakSetup {public User testuser1;public User testuser2;public User testuser3;+ public User testuser4;public User buildingUser;public User smartCityUser;public User serviceUser;@@ -115,6 +119,11 @@ public class KeycloakTestSetup extends AbstractKeycloakSetup {keycloakProvider.updateUserClientRoles(realmBuilding.getName(), testuser3Id, "account"); // Remove all roles for account client// Add realm rolekeycloakProvider.updateUserRealmRoles(realmBuilding.getName(), testuser3Id, keycloakProvider.addUserRealmRoles(realmBuilding.getName(), testuser3Id, REALM_ROLE_TEST));+ List<ClientRole> testuser4Roles = new ArrayList<>(Arrays.asList(REGULAR_USER_ROLES));+ testuser4Roles.add(ClientRole.WRITE_ADMIN);+ testuser4 = createUser(realmBuilding.getName(), "testuser4", "testuser4", "DemoA4", "DemoLast", null, true, false, true, testuser4Roles.toArray(new ClientRole[0]));+ this.testuser4Id = testuser4.getId();+ keycloakProvider.updateUserClientRoles(realmBuilding.getName(), testuser4Id, "account"); // Remove all roles for account clientbuildingUser = createUser(realmBuilding.getName(), "building", "building", "Building", "User", "[email protected]", true, noWriteAccess);this.buildingUserId = buildingUser.getId();keycloakProvider.updateUserClientRoles(realmBuilding.getName(), buildingUserId, "account"); // Remove all roles for account clientdiff --git a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovyindex 15a8aae9f..07e4c7b27 100644--- a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy+++ b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy@@ -615,13 +615,6 @@ class NotificationTest extends Specification implements ManagerContainerTrait {}notificationService.notificationHandlerMap.put(emailNotificationHandler.getTypeName(), mockEmailNotificationHandler)- expect: "the demo users to be created"- conditions.eventually {- def users = identityService.getIdentityProvider().queryUsers(new UserQuery().realm(new RealmPredicate(keycloakTestSetup.realmBuilding.name)).serviceUsers(false))- assert users.size() == 3- assert users.count { !TextUtil.isNullOrEmpty(it.email)} == 3- }-when: "an email notification is sent to a realm through same mechanism as rules"def notification = new Notification("Test",@@ -629,7 +622,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {Collections.singletonList(new Notification.Target(Notification.TargetType.REALM, managerTestSetup.realmBuildingName)), null, null)notificationService.sendNotification(notification, Notification.Source.REALM_RULESET, managerTestSetup.realmBuildingName)- then: "the email should have been sent to the realm users"+ then: "the email should have been sent to the realm users with email addresses and email notifications enabled"conditions.eventually {assert sentEmails.size() == 2assert sentEmails.every {it.content == "Hello world!"}diff --git a/test/src/test/groovy/org/openremote/test/users/UserResourceTest.groovy b/test/src/test/groovy/org/openremote/test/users/UserResourceTest.groovyindex 1621a5375..075e738b2 100644--- a/test/src/test/groovy/org/openremote/test/users/UserResourceTest.groovy+++ b/test/src/test/groovy/org/openremote/test/users/UserResourceTest.groovy@@ -20,11 +20,15 @@package org.openremote.test.usersimport jakarta.ws.rs.BadRequestException+import jakarta.ws.rs.NotAllowedException+import org.openremote.manager.security.ManagerIdentityService+import org.openremote.manager.security.ManagerKeycloakIdentityProviderimport org.openremote.manager.setup.SetupServiceimport org.openremote.model.Constantsimport org.openremote.model.query.UserQueryimport org.openremote.model.query.filter.RealmPredicateimport org.openremote.model.query.filter.StringPredicate+import org.openremote.model.security.Credentialimport org.openremote.model.security.Userimport org.openremote.setup.integration.KeycloakTestSetupimport org.openremote.model.security.ClientRole@@ -52,13 +56,22 @@ class UserResourceTest extends Specification implements ManagerContainerTrait {static UserResource regularUserMasterResource@Sharedstatic UserResource regularUserBuildingResource-+ @Shared+ static UserResource adminUserBuildingResource@Sharedstatic KeycloakTestSetup keycloakTestSetup+ @Shared+ static int resetPasswordRequests = 0def setupSpec() {def container = startContainer(defaultConfig(), defaultServices())keycloakTestSetup = container.getService(SetupService.class).getTaskOfType(KeycloakTestSetup.class)+ def identityProvider = Spy(container.getService(ManagerIdentityService.class).identityProvider as ManagerKeycloakIdentityProvider)+ container.getService(ManagerIdentityService.class).identityProvider = identityProvider+ identityProvider.requestPasswordReset(_ as String, _ as String) >> {+ realm, userId ->+ resetPasswordRequests+++ }def accessToken = authenticate(container,@@ -84,9 +97,18 @@ class UserResourceTest extends Specification implements ManagerContainerTrait {"testuser3").token+ def adminBuildingAccessToken = authenticate(+ container,+ keycloakTestSetup.realmBuilding.name,+ KEYCLOAK_CLIENT_ID,+ "testuser4",+ "testuser4"+ ).token+adminUserResource = getClientApiTarget(serverUri(serverPort), MASTER_REALM, accessToken).proxy(UserResource.class)regularUserMasterResource = getClientApiTarget(serverUri(serverPort), MASTER_REALM, regularMasterAccessToken).proxy(UserResource.class)regularUserBuildingResource = getClientApiTarget(serverUri(serverPort), keycloakTestSetup.realmBuilding.name, regularBuildingAccessToken).proxy(UserResource.class)+ adminUserBuildingResource = getClientApiTarget(serverUri(serverPort), keycloakTestSetup.realmBuilding.name, adminBuildingAccessToken).proxy(UserResource.class)}def "User queries"() {@@ -112,10 +134,11 @@ class UserResourceTest extends Specification implements ManagerContainerTrait {users = regularUserBuildingResource.query(null, new UserQuery().realm(new RealmPredicate(keycloakTestSetup.realmMaster.name)))then: "only non system users of the users realm should be returned"- users.size() == 5+ users.size() == 6users.count {it.isSystemAccount() && it.username == Constants.MANAGER_CLIENT_ID} == 0users.find {it.id == keycloakTestSetup.testuser2Id} != nullusers.find {it.id == keycloakTestSetup.testuser3Id} != null+ users.find {it.id == keycloakTestSetup.testuser4Id} != nullusers.find {it.id == keycloakTestSetup.buildingUserId} != nullusers.find {it.isServiceAccount() && it.id == keycloakTestSetup.serviceUser.id} != nullusers.find {it.isServiceAccount() && it.id == keycloakTestSetup.serviceUser2.id} != null@@ -124,28 +147,29 @@ class UserResourceTest extends Specification implements ManagerContainerTrait {users = regularUserBuildingResource.query(null, new UserQuery().realm(new RealmPredicate(keycloakTestSetup.realmMaster.name)).orderBy(new UserQuery.OrderBy(UserQuery.OrderBy.Property.USERNAME, false)))then: "only non system users of the users realm should be returned in username order"- users.size() == 5+ users.size() == 6users[0].username == keycloakTestSetup.buildingUser.usernameusers[1].username == keycloakTestSetup.serviceUser.usernameusers[2].username == keycloakTestSetup.serviceUser2.usernameusers[3].username == keycloakTestSetup.testuser2.usernameusers[4].username == keycloakTestSetup.testuser3.username+ users[5].username == keycloakTestSetup.testuser4.username- when: "a request is made for subset of users ordered by username descending"+ when: "a request is made for subset of users ordered by username descending (with wrong realm which will be automatically changed to the users realm)"users = regularUserBuildingResource.query(null, new UserQuery().realm(new RealmPredicate(keycloakTestSetup.realmMaster.name)).orderBy(new UserQuery.OrderBy(UserQuery.OrderBy.Property.USERNAME, true)).limit(2))then: "the correct users should be returned"users.size() == 2- users[0].username == keycloakTestSetup.testuser3.username- users[1].username == keycloakTestSetup.testuser2.username+ users[0].username == keycloakTestSetup.testuser4.username+ users[1].username == keycloakTestSetup.testuser3.username- when: "a request is made for another subset of users ordered by username descending"+ when: "a request is made for another subset of users ordered by username descending (with wrong realm which will be automatically changed to the users realm)"users = regularUserBuildingResource.query(null, new UserQuery().realm(new RealmPredicate(keycloakTestSetup.realmMaster.name)).orderBy(new UserQuery.OrderBy(UserQuery.OrderBy.Property.USERNAME, true)).limit(2).offset(3))then: "the correct users should be returned"users.size() == 2- users[0].username == keycloakTestSetup.serviceUser.username- users[1].username == keycloakTestSetup.buildingUser.username+ users[0].username == keycloakTestSetup.serviceUser2.username+ users[1].username == keycloakTestSetup.serviceUser.usernamewhen: "a request is made for only service users (users with a secret)"users = adminUserResource.query(null, new UserQuery().serviceUsers(true).realm(new RealmPredicate(keycloakTestSetup.realmBuilding.name)))@@ -178,9 +202,10 @@ class UserResourceTest extends Specification implements ManagerContainerTrait {.orderBy(new UserQuery.OrderBy(UserQuery.OrderBy.Property.USERNAME, false)))then: "only non restricted users of this realm should be returned"- users.size() == 2+ users.size() == 3users[0].username == keycloakTestSetup.serviceUser.usernameusers[1].username == keycloakTestSetup.testuser2.username+ users[2].username == keycloakTestSetup.testuser4.usernamewhen: "a request is made based on user attributes"users = regularUserBuildingResource.query(null,@@ -192,11 +217,12 @@ class UserResourceTest extends Specification implements ManagerContainerTrait {).orderBy(new UserQuery.OrderBy(UserQuery.OrderBy.Property.USERNAME, false)))then: "only matching users of this realm should be returned"- users.size() == 4+ users.size() == 5users[0].username == keycloakTestSetup.buildingUser.usernameusers[1].username == keycloakTestSetup.serviceUser.usernameusers[2].username == keycloakTestSetup.serviceUser2.usernameusers[3].username == keycloakTestSetup.testuser2.username+ users[4].username == keycloakTestSetup.testuser4.usernamewhen: "a request is made for users with the write:alarms client role"users = regularUserBuildingResource.query(null,@@ -206,9 +232,10 @@ class UserResourceTest extends Specification implements ManagerContainerTrait {.orderBy(new UserQuery.OrderBy(UserQuery.OrderBy.Property.USERNAME, false)))then: "only users of this realm with the write:alarms client role should be returned"- users.size() == 2+ users.size() == 3users[0].username == keycloakTestSetup.buildingUser.usernameusers[1].username == keycloakTestSetup.testuser3.username+ users[2].username == keycloakTestSetup.testuser4.username}def "Get and update roles"() {@@ -298,6 +325,94 @@ class UserResourceTest extends Specification implements ManagerContainerTrait {user.attributes.size() == 2user.attributes.any {it.name == EMAIL_NOTIFICATIONS_DISABLED_ATTRIBUTE && it.value == "true"}user.attributes.any {it.name == "test" && it.value == "testvalue"}++ when: "a user with ${Constants.WRITE_USER_ROLE} role updates their own user information"+ keycloakTestSetup.testuser3.setAttribute("selfUpdate", "success")+ def updatedUser = regularUserBuildingResource.updateCurrent(null, keycloakTestSetup.testuser3)++ then: "the update should succeed"+ updatedUser != null+ updatedUser.attributes.any { it.name == "selfUpdate" && it.value == "success" }++ when: "the user tries to update another user's information"+ keycloakTestSetup.testuser2.setAttribute("unauthorizedUpdate", "shouldFail")+ regularUserBuildingResource.updateCurrent(null, keycloakTestSetup.testuser2)++ then: "an exception should be thrown"+ thrown(ForbiddenException)++ when: "an admin user tries to update another user's information"+ keycloakTestSetup.testuser3.setAttribute("authorizedUpdate", "shouldNotFail")+ updatedUser = adminUserResource.update(null, keycloakTestSetup.testuser3.realm, keycloakTestSetup.testuser3)++ then: "the update should succeed"+ updatedUser.attributes.any { it.name == "authorizedUpdate" && it.value == "shouldNotFail" }++ when: "the admin verifies the user's attributes were updated"+ def verifiedUser = adminUserResource.get(null, keycloakTestSetup.testuser3.realm, keycloakTestSetup.testuser3.id)++ then: "the self-update attribute should be present"+ verifiedUser.attributes.any { it.name == "selfUpdate" && it.value == "success" }++ and: "the authorized update attribute should be present"+ verifiedUser.attributes.any { it.name == "authorizedUpdate" && it.value == "shouldNotFail" }++ when: "a regular user tries to update another user's password"+ regularUserBuildingResource.updatePassword(null, keycloakTestSetup.realmBuilding.name, keycloakTestSetup.testuser2Id, new Credential("newPassword", false))++ then: "an exception should be thrown"+ thrown(ForbiddenException)++ when: "an admin user tries to update another user's password"+ adminUserResource.updatePassword(null, keycloakTestSetup.testuser2.realm, keycloakTestSetup.testuser2Id, new Credential("newPassword", false))++ then: "the password should have been updated"+ def testUser2BuildingAccessToken = authenticate(+ container,+ keycloakTestSetup.realmBuilding.name,+ KEYCLOAK_CLIENT_ID,+ "testuser2",+ "newPassword"+ ).token+ testUser2BuildingAccessToken != null+ }++ def "Request password reset"() {+ when: "a user with ${Constants.WRITE_USER_ROLE} permission requests a password reset for themselves"+ regularUserBuildingResource.requestPasswordResetCurrent(null)++ then: "it should succeed"+ resetPasswordRequests == 1++ when: "the same user requests a password reset for another user in the same realm"+ regularUserBuildingResource.requestPasswordReset(null, keycloakTestSetup.realmBuilding.name, keycloakTestSetup.testuser2.id)++ then: "an exception should occur"+ thrown(ForbiddenException)++ when: "the same user requests a password reset for another user in a different realm"+ regularUserBuildingResource.requestPasswordReset(null, keycloakTestSetup.realmBuilding.name, keycloakTestSetup.testuser1.id)++ then: "an exception should occur"+ thrown(ForbiddenException)++ when: "a user with ${Constants.WRITE_ADMIN_ROLE} role requests a password reset for another user in the same realm"+ adminUserBuildingResource.requestPasswordReset(null, keycloakTestSetup.realmBuilding.name, keycloakTestSetup.testuser2.id)++ then: "it should succeed"+ resetPasswordRequests == 2++ when: "a user with ${Constants.WRITE_ADMIN_ROLE} role in one realm requests a password reset for another user in a different realm"+ adminUserBuildingResource.requestPasswordReset(null, MASTER_REALM, keycloakTestSetup.testuser1.id)++ then: "an exception should occur"+ thrown(NotAllowedException)++ when: "a super admin requests a password reset for another user in a different realm"+ adminUserResource.requestPasswordReset(null, keycloakTestSetup.realmBuilding.name, keycloakTestSetup.testuser2.id)++ then: "it should succeed"+ resetPasswordRequests == 3}def "Create invalid users"() {diff --git a/ui/app/manager/src/headers.ts b/ui/app/manager/src/headers.tsindex 13c665a6d..01fafa946 100644--- a/ui/app/manager/src/headers.ts+++ b/ui/app/manager/src/headers.ts@@ -95,9 +95,7 @@ export function headerItemAccount<S extends AppStateKeyed, A extends AnyAction>(value: "account",href: "account",text: "account",- roles: {- account: ["manage-account"]- }+ roles: ["write:user"]};}export function headerItemUsers<S extends AppStateKeyed, A extends AnyAction>(orApp: OrApp<S>): HeaderItem {diff --git a/ui/app/manager/src/pages/page-account.ts b/ui/app/manager/src/pages/page-account.tsindex 1e4fdb833..7ed43c5fe 100644--- a/ui/app/manager/src/pages/page-account.ts+++ b/ui/app/manager/src/pages/page-account.ts@@ -37,7 +37,7 @@ interface UserModel extends User {}@customElement("page-account")-export class PageAccount extends Page<AppStateKeyed> {+export class PageAccount extends Page<AppStateKeyed> {protected static _getStyle(): CSSResult {return css`@@ -47,6 +47,7 @@ export class PageAccount extends Page<AppStateKeyed> {display: flex;flex-direction: column;}+#title {padding: 0 20px;font-size: 18px;@@ -63,6 +64,7 @@ export class PageAccount extends Page<AppStateKeyed> {margin-right: 10px;margin-left: 14px;}+.panel {flex: 0;width: 100%;@@ -114,7 +116,7 @@ export class PageAccount extends Page<AppStateKeyed> {flex: 1 1 0;gap: 20px;}-+h5 {margin-bottom: 0;}@@ -172,7 +174,7 @@ export class PageAccount extends Page<AppStateKeyed> {public connectedCallback() {super.connectedCallback();this._getPasswordPolicy();- }+ }protected render(): TemplateResult | void {@@ -188,7 +190,7 @@ export class PageAccount extends Page<AppStateKeyed> {`;}- const readonly = !manager.hasRole(ClientRole.WRITE_ADMIN);+ const readonly = !manager.hasRole(ClientRole.WRITE_USER);return html`<div id="wrapper">@@ -197,22 +199,22 @@ export class PageAccount extends Page<AppStateKeyed> {<or-translate value="account"></div><div id="content" class="panel">-+<p class="panel-title">${i18next.t("user")} ${i18next.t("settings")}</p>-+<!-- Account settings row -->${guard([this._user], () => until(- this._getAccountRowTemplate(this._user, readonly, (_user, dirty, invalid) => {- this._dirty = dirty;- this._invalid = invalid;- })+ this._getAccountRowTemplate(this._user, readonly, (_user, dirty, invalid) => {+ this._dirty = dirty;+ this._invalid = invalid;+ })))}-+<!-- Actions row (such as the save button) -->${when(this._user, () => until(this._getActionsRowTemplate(this._user)))}-+</div>-+${when(manager.isKeycloak(), () => html`<div class="panel"><p class="panel-title">@@ -220,8 +222,9 @@ export class PageAccount extends Page<AppStateKeyed> {</p><div class="row"><div class="column">- <or-mwc-input .type="${InputType.BUTTON}" label="${i18next.t('twoFactorConfigure')}" outlined- @or-mwc-input-changed="${() => manager.login({ action: "CONFIGURE_TOTP" })}"+ <or-mwc-input .type="${InputType.BUTTON}" label="${i18next.t('twoFactorConfigure')}"+ outlined+ @or-mwc-input-changed="${() => manager.login({action: "CONFIGURE_TOTP"})}"></or-mwc-input></div></div>@@ -236,8 +239,9 @@ export class PageAccount extends Page<AppStateKeyed> {* Will call {@link onchange} when an input field submits a new value.*/protected async _getAccountRowTemplate(user?: UserModel, readonly = true, onchange?: (user: User, dirty: boolean, invalid: boolean) => void): Promise<TemplateResult> {- const registrationEmailAsUsername = true;- if(!user) {+ const realmResponse = await manager.rest.api.RealmResource.get(manager.displayRealm);+ const registrationEmailAsUsername = realmResponse.data.registrationEmailAsUsername;+ if (!user) {user = await this._getUser();}return html`@@ -250,7 +254,7 @@ export class PageAccount extends Page<AppStateKeyed> {.type="${InputType.TEXT}"?required="${!registrationEmailAsUsername}".disabled="${true}"- minLength="3" maxLength="255" pattern="[A-Za-z0-9\-_+@.ßçʊ]+"+ minLength="3" maxLength="255" pattern="[A-Za-z0-9\\-_+@\\.ßçʊÇʊ]+".validationMessage="${i18next.t("invalidUsername")}".value="${user?.username}" autocomplete="false"@or-mwc-input-changed="${(e: OrInputChangedEvent) => {@@ -300,30 +304,41 @@ export class PageAccount extends Page<AppStateKeyed> {</div><div class="column"><h5>${i18next.t("password")}</h5>- <or-mwc-input id="new-password" class="validate"- .label="${i18next.t("password")}"- .type="${InputType.PASSWORD}"- ?readonly="${readonly}"- .disabled="${!user}"- min="1" autocomplete="false"- @or-mwc-input-changed="${(_e: OrInputChangedEvent) => {- const changed = this._onPasswordChanged(user);- onchange?.(user, changed, this._isInvalid());- }}"- ></or-mwc-input>- <or-mwc-input id="new-repeatPassword"- .label="${i18next.t("repeatPassword")}"- .type="${InputType.PASSWORD}"- helperPersistent- ?readonly="${readonly}"- .disabled="${!user}"- min="1" autocomplete="false"- @or-mwc-input-changed="${(_e: OrInputChangedEvent) => {- const changed = this._onPasswordChanged(user);- onchange?.(user, changed, this._isInvalid());- }}"- ></or-mwc-input>- ${when(this._passwordPolicy, () => until(this._getPasswordPolicyTemplate(user, this._passwordPolicy)))}+ ${registrationEmailAsUsername ? html`+ <!-- Reset password button when email as username is configured -->+ <or-mwc-input id="reset-password" raised+ .label="${i18next.t("resetPassword")}"+ .type="${InputType.BUTTON}"+ .disabled="${!user.email}"+ @or-mwc-input-changed="${(e: OrInputChangedEvent) => this._onResetPasswordBtnClick(e)}"+ ></or-mwc-input>+ ` : html`+ <!-- Direct password input fields when email as username not configured -->+ <or-mwc-input id="new-password" class="validate"+ .label="${i18next.t("password")}"+ .type="${InputType.PASSWORD}"+ ?readonly="${readonly}"+ .disabled="${!user}"+ min="1" autocomplete="false"+ @or-mwc-input-changed="${(_e: OrInputChangedEvent) => {+ const changed = this._onPasswordChanged(user);+ onchange?.(user, changed, this._isInvalid());+ }}"+ ></or-mwc-input>+ <or-mwc-input id="new-repeatPassword"+ .label="${i18next.t("repeatPassword")}"+ .type="${InputType.PASSWORD}"+ helperPersistent+ ?readonly="${readonly}"+ .disabled="${!user}"+ min="1" autocomplete="false"+ @or-mwc-input-changed="${(_e: OrInputChangedEvent) => {+ const changed = this._onPasswordChanged(user);+ onchange?.(user, changed, this._isInvalid());+ }}"+ ></or-mwc-input>+ ${when(this._passwordPolicy, () => until(this._getPasswordPolicyTemplate(user, this._passwordPolicy)))}+ `}</div></div>@@ -379,7 +394,7 @@ export class PageAccount extends Page<AppStateKeyed> {* Checks if the input fields are valid, and calls the {@link _updateUser} function.*/protected _onSaveBtnClick(_e: OrInputChangedEvent) {- if(this._user && !this._isInvalid()) {+ if (this._user && !this._isInvalid()) {this._updateUser(this._user);} else {console.warn("The fields are invalid!");@@ -387,13 +402,25 @@ export class PageAccount extends Page<AppStateKeyed> {}}+ /**+ * HTML callback function for when the 'Reset Password' button is clicked.+ */+ protected _onResetPasswordBtnClick(_e: OrInputChangedEvent) {+ if (this._user && !this._isInvalid()) {++ manager.rest.api.UserResource.requestPasswordResetCurrent()+ .then(() => showSnackbar(undefined, i18next.t("resetPasswordConfirmation")))+ .catch((reason) => showSnackbar(undefined, i18next.t("errorOccurred")));+ }+ }+/*** Function that returns whether the input fields are all valid.* Listens for HTML elements with the 'validate' class.*/protected _isInvalid(): boolean {const validateArray = this.shadowRoot.querySelectorAll(".validate");- if(validateArray.length === 0) {+ if (validateArray.length === 0) {return true;}return Array.from(validateArray).filter(e => e instanceof OrMwcInput).some(input => !(input as OrMwcInput).valid);@@ -410,21 +437,17 @@ export class PageAccount extends Page<AppStateKeyed> {* Function that fetches (and returns) the currently logged in {@link UserModel} from the Manager HTTP API.*/protected async _getUser(): Promise<UserModel> {- if(!this._user) {+ if (!this._user) {try {- const usersResponse = await manager.rest.api.UserResource.query({- realmPredicate: {name: manager.getRealm()},- usernames: [{predicateType: "string", value: manager.username}],- limit: 1- } as UserQuery);+ const usersResponse = await manager.rest.api.UserResource.getCurrent();- if(usersResponse.status < 200 || usersResponse.status > 299) {+ if (usersResponse.status < 200 || usersResponse.status > 299) {throw new Error(usersResponse.statusText);}- if(!usersResponse.data || usersResponse.data.length === 0) {+ if (!usersResponse.data) {throw new Error("No user could be found.");}- this._user = usersResponse.data[0];+ this._user = usersResponse.data;} catch (e) {console.error(e);@@ -439,19 +462,29 @@ export class PageAccount extends Page<AppStateKeyed> {* If the password has been changed, it will, after updating the user, also request to reset the password.*/protected async _updateUser(user: UserModel): Promise<void> {- await manager.rest.api.UserResource.update(manager.getRealm(), user).then(() => {- if(user.password) {+ try {+ await manager.rest.api.UserResource.updateCurrent(user);++ if (user.password) {const credentials = {value: user.password} as Credential;- manager.rest.api.UserResource.resetPassword(manager.getRealm(), user.id, credentials)- .then(() => {- showSnackbar(undefined, "saveUserSucceeded");- })- .catch(() => {- showSnackbar(undefined, "saveUserFailed");- });- this._dirty = false;+ try {+ await manager.rest.api.UserResource.updatePasswordCurrent(credentials);+ showSnackbar(undefined, "saveUserSucceeded");+ } catch (e) {+ showSnackbar(undefined, "saveUserFailed");+ return;+ }+ } else {+ showSnackbar(undefined, "saveUserSucceeded");}- })++ // Update the stored user with the saved version and reset dirty flag+ this._user = {...user};+ this._dirty = false;+ } catch (e) {+ console.error("Failed to update user:", e);+ showSnackbar(undefined, "saveUserFailed");+ }}/**@@ -463,67 +496,82 @@ export class PageAccount extends Page<AppStateKeyed> {})}- /**- * Function that formats the password policy into a displayable html format.- */- protected async _getPasswordPolicyTemplate(user: UserModel, passwordPolicy = this._passwordPolicy): Promise<TemplateResult> {- const policyMap = new Map(passwordPolicy.map(policyStr => {- const name = policyStr.split("(")[0];- const value = policyStr.split("(")[1].split(")")[0];- return [name, value];- }));- const policies = Array.from(policyMap.keys());- const policyTexts: TemplateResult[] = [];-- // Minimum / maximum length warning- if(policies.includes("length") && policies.includes("maxLength")) {- policyTexts.push(html`<or-translate value="password-policy-invalid-length" .options="${{ 0: policyMap.get("length"), 1: policyMap.get("maxLength") }}"></or-translate>`);- } else if(policies.includes("length")) {- policyTexts.push(html`<or-translate value="password-policy-invalid-length-too-short" .options="${{ 0: policyMap.get("length") }}"></or-translate>`);- } else if(policies.includes("maxLength")) {- policyTexts.push(html`<or-translate value="password-policy-invalid-length-too-long" .options="${{ 0: policyMap.get("maxLength") }}"></or-translate>`);- }-- // Special characters- if(policies.includes("specialChars")) {- const value = policyMap.get("specialChars");- const translation = value == "1" ? "password-policy-special-chars-single" : "password-policy-special-chars";- policyTexts.push(html`<or-translate value="${translation}" .options="${{ 0: value }}"></or-translate>`);- }-- // Digits/numbers- if(policies.includes("digits")) {- const value = policyMap.get("digits");- const translation = value == "1" ? "password-policy-digits-single" : "password-policy-digits";- policyTexts.push(html`<or-translate value="${translation}" .options="${{ 0: value }}"></or-translate>`);- }-- // Uppercase / lowercase letters- if(policies.includes("upperCase")) {- const value = policyMap.get("upperCase");- const translation = value == "1" ? "password-policy-uppercase-single" : "password-policy-uppercase";- policyTexts.push(html`<or-translate value="${translation}" .options="${{ 0: value }}"></or-translate>`);- }-- // Warn for recently used passwords- if(policies.includes("passwordHistory")) {- policyTexts.push(html`<or-translate value="password-policy-recently-used"></or-translate>`);- }-- // Cannot be username and/or email- if(policies.includes("notUsername") && policies.includes("notEmail")) {- policyTexts.push(html`<or-translate value="password-policy-not-email-username"></or-translate>`);- } else if(policies.includes("notUsername")) {- policyTexts.push(html`<or-translate value="password-policy-not-username"></or-translate>`);- } else if(policies.includes("notEmail")) {- policyTexts.push(html`<or-translate value="password-policy-not-email"></or-translate>`);- }-- return html`- <ul>- ${map(policyTexts, text => html`<li>${text}</li>`)}- </ul>- `;- }+ /**+ * Function that formats the password policy into a displayable html format.+ */+ protected async _getPasswordPolicyTemplate(user: UserModel, passwordPolicy = this._passwordPolicy): Promise<TemplateResult> {+ const policyMap = new Map(passwordPolicy.map(policyStr => {+ const name = policyStr.split("(")[0];+ const value = policyStr.split("(")[1]?.split(")")[0];+ return [name, value];+ }));+ const policies = Array.from(policyMap.keys());+ const policyTexts: TemplateResult[] = [];++ // Minimum / maximum length warning+ if (policies.includes("length") && policies.includes("maxLength")) {+ policyTexts.push(html`+ <or-translate value="password-policy-invalid-length" .options="${{+ 0: policyMap.get("length"),+ 1: policyMap.get("maxLength")+ }}"></or-translate>`);+ } else if (policies.includes("length")) {+ policyTexts.push(html`+ <or-translate value="password-policy-invalid-length-too-short"+ .options="${{0: policyMap.get("length")}}"></or-translate>`);+ } else if (policies.includes("maxLength")) {+ policyTexts.push(html`+ <or-translate value="password-policy-invalid-length-too-long"+ .options="${{0: policyMap.get("maxLength")}}"></or-translate>`);+ }++ // Special characters+ if (policies.includes("specialChars")) {+ const value = policyMap.get("specialChars");+ const translation = value === "1" ? "password-policy-special-chars-single" : "password-policy-special-chars";+ policyTexts.push(html`+ <or-translate value="${translation}" .options="${{0: value}}"></or-translate>`);+ }+ // Digits/numbers+ if (policies.includes("digits")) {+ const value = policyMap.get("digits");+ const translation = value === "1" ? "password-policy-digits-single" : "password-policy-digits";+ policyTexts.push(html`+ <or-translate value="${translation}" .options="${{0: value}}"></or-translate>`);+ }++ // Uppercase / lowercase letters+ if (policies.includes("upperCase")) {+ const value = policyMap.get("upperCase");+ const translation = value === "1" ? "password-policy-uppercase-single" : "password-policy-uppercase";+ policyTexts.push(html`+ <or-translate value="${translation}" .options="${{0: value}}"></or-translate>`);+ }++ // Warn for recently used passwords+ if (policies.includes("passwordHistory")) {+ policyTexts.push(html`+ <or-translate value="password-policy-recently-used"></or-translate>`);+ }++ // Cannot be username and/or email+ if (policies.includes("notUsername") && policies.includes("notEmail")) {+ policyTexts.push(html`+ <or-translate value="password-policy-not-email-username"></or-translate>`);+ } else if (policies.includes("notUsername")) {+ policyTexts.push(html`+ <or-translate value="password-policy-not-username"></or-translate>`);+ } else if (policies.includes("notEmail")) {+ policyTexts.push(html`+ <or-translate value="password-policy-not-email"></or-translate>`);+ }++ return html`+ <ul>+ ${map(policyTexts, text => html`+ <li>${text}</li>`)}+ </ul>+ `;+ }}diff --git a/ui/app/manager/src/pages/page-users.ts b/ui/app/manager/src/pages/page-users.tsindex ec6121bd0..b87089303 100644--- a/ui/app/manager/src/pages/page-users.ts+++ b/ui/app/manager/src/pages/page-users.ts@@ -382,7 +382,7 @@ export class PageUsers extends Page<AppStateKeyed> {// This is handled asynchronously, so it will not 'wait' before the request has succeeded.if (user.password) {const credentials = {value: user.password} as Credential;- manager.rest.api.UserResource.resetPassword(manager.displayRealm, user.id, credentials).catch(e => {+ manager.rest.api.UserResource.updatePassword(manager.displayRealm, user.id, credentials).catch(e => {if(isAxiosError(e) && e.response.status !== 404) {showSnackbar(undefined, "savePasswordFailed");}@@ -867,7 +867,7 @@ export class PageUsers extends Page<AppStateKeyed> {.label="${i18next.t("username")}".type="${InputType.TEXT}" minLength="3" maxLength="255"?required="${isServiceUser || !this._registrationEmailAsUsername}"- pattern="[A-Za-z0-9_+@.\-ßçʊÇʊ]+"+ pattern="[A-Za-z0-9_+@\\.\\-ßçʊÇʊ]+".value="${user.username}" autocomplete="false".validationMessage="${i18next.t("invalidUsername")}"@or-mwc-input-changed="${(e: OrInputChangedEvent) => {diff --git a/ui/app/shared/locales/ar/or.json b/ui/app/shared/locales/ar/or.jsonindex f0cd782c2..d119e04c3 100644--- a/ui/app/shared/locales/ar/or.json+++ b/ui/app/shared/locales/ar/or.json@@ -262,6 +262,8 @@"sending": "إرسال","submit": "رفع","password": "كلمة السر",+ "resetPassword": "إعادة تعيين كلمة السر",+ "resetPasswordConfirmation": "تم إرسال بريد إلكتروني لإعادة تعيين كلمة السر الخاصة بك.","repeatPassword": "إعادة كتابة كلمة السر","permissions":"الصلاحيات","noChildAssets": "لايوجد مكون فرعي",diff --git a/ui/app/shared/locales/cn/or.json b/ui/app/shared/locales/cn/or.jsonindex 876dc1977..052b6c489 100644--- a/ui/app/shared/locales/cn/or.json+++ b/ui/app/shared/locales/cn/or.json@@ -282,6 +282,8 @@"sending": "发送中","submit": "提交","password": "密码",+ "resetPassword": "重置密码",+ "resetPasswordConfirmation": "已发送电子邮件重置您的密码。","repeatPassword": "重复密码","details": "Details","permissions":"权限",diff --git a/ui/app/shared/locales/de/or.json b/ui/app/shared/locales/de/or.jsonindex 68d380a33..e6c76aee5 100644--- a/ui/app/shared/locales/de/or.json+++ b/ui/app/shared/locales/de/or.json@@ -299,6 +299,8 @@"sending": "Senden","submit": "Einreichen","password": "Passwort",+ "resetPassword": "Passwort zurücksetzen",+ "resetPasswordConfirmation": "Eine E-Mail zum Zurücksetzen Ihres Passworts wurde gesendet.","repeatPassword": "Passwort wiederholen","details": "Details","permissions":"Berechtigungen",diff --git a/ui/app/shared/locales/en/or.json b/ui/app/shared/locales/en/or.jsonindex 6eff0b884..6abf68f5d 100644--- a/ui/app/shared/locales/en/or.json+++ b/ui/app/shared/locales/en/or.json@@ -324,7 +324,9 @@"loginTheme": "Login theme","emailTheme": "Email theme","resetPasswordAllowed": "Password reset allowed",- "rememberMe": "Remember me",+ "resetPassword": "Reset Password",+ "resetPasswordConfirmation": "An email has been sent to reset your password.",+ "rememberMe": "Remember me","deleteRealmConfirm":"Are you sure you want to delete this Realm?","serviceUser": "Service user","user_plural": "Users",diff --git a/ui/app/shared/locales/es/or.json b/ui/app/shared/locales/es/or.jsonindex a617bec6b..ade75d15d 100644--- a/ui/app/shared/locales/es/or.json+++ b/ui/app/shared/locales/es/or.json@@ -283,6 +283,8 @@"sending": "Enviando","submit": "Enviar","password": "Contraseña",+ "resetPassword": "Restablecer contraseña",+ "resetPasswordConfirmation": "Se ha enviado un correo electrónico para restablecer su contraseña.","repeatPassword": "Repetir contraseña","details": "Detalles","permissions": "Permisos",diff --git a/ui/app/shared/locales/fr/or.json b/ui/app/shared/locales/fr/or.jsonindex 09eaa5af8..3e720d094 100644--- a/ui/app/shared/locales/fr/or.json+++ b/ui/app/shared/locales/fr/or.json@@ -283,6 +283,8 @@"sending": "Envoi en cours","submit": "Soumettre","password": "Mot de passe",+ "resetPassword": "Réinitialiser le mot de passe",+ "resetPasswordConfirmation": "Un e-mail a été envoyé pour réinitialiser votre mot de passe.","repeatPassword": "Répéter le mot de passe","details": "Des détails","permissions":"Autorisations",diff --git a/ui/app/shared/locales/it/or.json b/ui/app/shared/locales/it/or.jsonindex 9b41fb9fe..e3a463e18 100644--- a/ui/app/shared/locales/it/or.json+++ b/ui/app/shared/locales/it/or.json@@ -280,6 +280,8 @@"sending": "Invio","submit": "Invia","password": "Password",+ "resetPassword": "Reimposta password",+ "resetPasswordConfirmation": "È stata inviata un'email per reimpostare la password.","repeatPassword": "Ripeti password","details": "Particolari","permissions":"Permessi",diff --git a/ui/app/shared/locales/nl/or.json b/ui/app/shared/locales/nl/or.jsonindex c82e1b2c5..be64bd3df 100644--- a/ui/app/shared/locales/nl/or.json+++ b/ui/app/shared/locales/nl/or.json@@ -324,6 +324,8 @@"loginTheme": "Login thema","emailTheme": "Email thema","resetPasswordAllowed": "Wachtwoord kan hersteld worden",+ "resetPassword": "Wachtwoord herstellen",+ "resetPasswordConfirmation": "Er is een e-mail verzonden om je wachtwoord te herstellen.","rememberMe": "Ingelogd blijven","deleteRealmConfirm":"Weet je zeker dat je deze realm wil verwijderen?","serviceUser": "Service gebruiker",diff --git a/ui/app/shared/locales/pt/or.json b/ui/app/shared/locales/pt/or.jsonindex 29c6762a2..6f6876cfd 100644--- a/ui/app/shared/locales/pt/or.json+++ b/ui/app/shared/locales/pt/or.json@@ -281,6 +281,8 @@"sending": "Enviando","submit": "Enviar","password": "Senha",+ "resetPassword": "Redefinir senha",+ "resetPasswordConfirmation": "Um e-mail foi enviado para redefinir sua senha.","repeatPassword": "Repetir senha","details": "Detalhes","permissions":"Permissões",diff --git a/ui/app/shared/locales/ro/or.json b/ui/app/shared/locales/ro/or.jsonindex 6234a2c1b..4bda1fe42 100644--- a/ui/app/shared/locales/ro/or.json+++ b/ui/app/shared/locales/ro/or.json@@ -360,6 +360,8 @@"sending": "Se trimite","submit": "Trimite","password": "Parola",+ "resetPassword": "Resetare parolă",+ "resetPasswordConfirmation": "Un e-mail a fost trimis pentru a vă reseta parola.","repeatPassword": "Repeta parola","details": "Detalii","permissions":"Permisiuni",diff --git a/ui/app/shared/locales/uk/or.json b/ui/app/shared/locales/uk/or.jsonindex aec504581..04348c670 100644--- a/ui/app/shared/locales/uk/or.json+++ b/ui/app/shared/locales/uk/or.json@@ -369,6 +369,8 @@"sending": "Надсилання","submit": "Надіслати","password": "Пароль",+ "resetPassword": "Скинути пароль",+ "resetPasswordConfirmation": "На вашу електронну пошту надіслано лист для скидання пароля.","repeatPassword": "Повторіть пароль","details": "Деталі","permissions": "Дозволи",