Skip to content

Commit

Permalink
use a shorter user id
Browse files Browse the repository at this point in the history
when using webauthn/passkeys, there is a limit in the used userid of 64 bytes
  • Loading branch information
dasniko committed Feb 15, 2024
1 parent ace4078 commit 783d356
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package dasniko.keycloak.user.flintstones.repo;

import lombok.SneakyThrows;
import org.keycloak.common.util.SecretGenerator;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

/**
Expand All @@ -16,12 +16,12 @@ public class FlintstonesRepository {

@SneakyThrows
FlintstonesRepository() {
users.add(new FlintstoneUser("66671638-b48a-4bab-8f37-d20efea42ce3", "[email protected]", "Fred", "Flintstone", true, List.of("stoneage")));
users.add(new FlintstoneUser("ced34250-cb88-4cc0-87e8-6fca25a926e3", "[email protected]", "Wilma", "Flintstone", true, List.of("stoneage")));
users.add(new FlintstoneUser("12df5d9c-c6ac-48e8-8086-b10ab7985a65", "[email protected]", "Pebbles", "Flintstone", true, List.of("stoneage")));
users.add(new FlintstoneUser("1b6c083b-3e14-40ef-897c-a0d3cdba22ed", "[email protected]", "Barney", "Rubble", true, List.of("stoneage")));
users.add(new FlintstoneUser("42c88684-c585-4d83-b748-7a49213c4690", "[email protected]", "Betty", "Rubble", true, null));
users.add(new FlintstoneUser("08950eb2-920b-48f5-bbe0-9694e8ad6fc4", "[email protected]", "Bam Bam", "Rubble", false, null));
users.add(new FlintstoneUser("12345", "[email protected]", "Fred", "Flintstone", true, List.of("stoneage")));
users.add(new FlintstoneUser("23456", "[email protected]", "Wilma", "Flintstone", true, List.of("stoneage")));
users.add(new FlintstoneUser("34567", "[email protected]", "Pebbles", "Flintstone", true, List.of("stoneage")));
users.add(new FlintstoneUser("45678", "[email protected]", "Barney", "Rubble", true, List.of("stoneage")));
users.add(new FlintstoneUser("56789", "[email protected]", "Betty", "Rubble", true, null));
users.add(new FlintstoneUser("67890", "[email protected]", "Bam Bam", "Rubble", false, null));
}

List<FlintstoneUser> getAllUsers() {
Expand Down Expand Up @@ -69,7 +69,7 @@ boolean updateCredentials(String id, String password) {
}

void createUser(FlintstoneUser user) {
user.setId(UUID.randomUUID().toString());
user.setId(SecretGenerator.getInstance().randomString(5));
user.setCreated(System.currentTimeMillis());
users.add(user);
}
Expand Down

0 comments on commit 783d356

Please sign in to comment.