From 9d9625509383b33a611b84f46e477ad208c84fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20P=C3=B3=C5=82torak?= Date: Sun, 21 Apr 2024 15:12:41 +0200 Subject: [PATCH 1/2] Made usernames emails in placeholderdata --- .../dev/corn/cornbackend/config/PlaceholderData.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/corn-backend/src/main/java/dev/corn/cornbackend/config/PlaceholderData.java b/corn-backend/src/main/java/dev/corn/cornbackend/config/PlaceholderData.java index f4385ee0..495f2536 100644 --- a/corn-backend/src/main/java/dev/corn/cornbackend/config/PlaceholderData.java +++ b/corn-backend/src/main/java/dev/corn/cornbackend/config/PlaceholderData.java @@ -75,12 +75,12 @@ public void run(String... args) { ItemStatus.DONE, ItemStatus.DONE, ItemStatus.DONE ); List users = userRepository.findAllById(Stream.of( - userService.registerUser("Jan", "Kowalski", "jan"), - userService.registerUser("Andrzej", "Switch", "andrzej"), - userService.registerUser("John", "Doe", "john"), - userService.registerUser("Jane", "Doe", "jane"), - userService.registerUser("Alice", "Smith", "alice"), - userService.registerUser("Bob", "Johnson", "bob") + userService.registerUser("Jan", "Kowalski", "jan@gmail.com"), + userService.registerUser("Andrzej", "Switch", "andrzej@gmail.com"), + userService.registerUser("John", "Doe", "john@gmail.com"), + userService.registerUser("Jane", "Doe", "jane@gmail.com"), + userService.registerUser("Alice", "Smith", "alice@gmail.com"), + userService.registerUser("Bob", "Johnson", "bob@gmail.com") ).map(UserResponse::userId).toList()); User projectOwner = drawRandom(users); From cee2547bb4f30044855d09bc0e149b4b5647e87e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20P=C3=B3=C5=82torak?= Date: Sun, 21 Apr 2024 21:38:55 +0200 Subject: [PATCH 2/2] Added email as username in keycloak init --- .../realm/corn/PlaceholderUsers.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/auth-server/keycloak-initializer/src/main/java/keycloakinitializer/realm/corn/PlaceholderUsers.java b/auth-server/keycloak-initializer/src/main/java/keycloakinitializer/realm/corn/PlaceholderUsers.java index 8df17ef7..4493b18f 100644 --- a/auth-server/keycloak-initializer/src/main/java/keycloakinitializer/realm/corn/PlaceholderUsers.java +++ b/auth-server/keycloak-initializer/src/main/java/keycloakinitializer/realm/corn/PlaceholderUsers.java @@ -10,17 +10,16 @@ public class PlaceholderUsers { - private static final String MAIL_SUFFIX = "@mail.pl"; private static final String DEFAULT_ROLE = "default-roles-corn"; public static List generate() { return Stream.of( - new SimpleUser("Jan", "Kowalski", "jan", "123"), - new SimpleUser("Andrzej", "Switch", "andrzej", "123"), - new SimpleUser("John", "Doe", "john", "123"), - new SimpleUser("Jane", "Doe", "jane", "123"), - new SimpleUser("Alice", "Smith", "alice", "123"), - new SimpleUser("Bob", "Johnson", "bob", "123") + new SimpleUser("Jan", "Kowalski", "jan@gmail.com", "123"), + new SimpleUser("Andrzej", "Switch", "andrzej@gmail.com", "123"), + new SimpleUser("John", "Doe", "john@gmail.com", "123"), + new SimpleUser("Jane", "Doe", "jane@gmail.com", "123"), + new SimpleUser("Alice", "Smith", "alice@gmail.com", "123"), + new SimpleUser("Bob", "Johnson", "bob@gmail.com", "123") ).map(SimpleUser::intoUserRepresentation).toList(); } @@ -31,7 +30,7 @@ UserRepresentation intoUserRepresentation() { setUsername(username()); setFirstName(name); setLastName(surname); - setEmail(username.toLowerCase()+MAIL_SUFFIX); + setEmail(username()); setEmailVerified(true); setEnabled(true); setRealmRoles(List.of(DEFAULT_ROLE));