Search code examples
keycloakkeycloak-rest-api

How is the id generated for USER_ENTITY and USER_ATTRIBUTE table in Keycloak DB?


I am new to the Hibernate, and trying to understand how the Primary Key for USER_ENTITY and USER_ATTRIBUTE is generated. When I run the Keycloak server in DEBUG mode I could see the ID is being passed to the org.keycloak.models.jpa.entities.UserEntity, but I am unable to find out how the ID is being generated? Any lead is highly appreciated!

Thanks


Solution

  • Basically it is a random UUID generated in KeycloakModelUtil.generateId(). It is called by the JpaUserProvider.