Create group on user registration

This is a two part question. First is the actual goal I’m trying to accomplish. Second is helping me get started because I’m a PHP dev, and my Java skills are extremely rusty.

I’m wanting to create a new group named admin-[username] when a new user is registered. I think this will require writing an extension.

However, I’m not entirely sure where to start. I downloaded the Keycloak source, got it to build (I think), and tried starting with examples from here:

I can’t get them to build. I put the code here:

I then tried to build the class files, but no luck. Am I on the right track?


I figured it out by following this extremely helpful guide:

Also, I used the spi-registration-profile by zonaut (repo linked above), but I had to make sure to update the <keycloak.version> tag in the pom.xml of the project. From there, it was pretty trivial to add a group upon user registration.