Attendee User
In this lesson, we'll expand our Keycloak configuration by adding an attendee user and corresponding roles.
Adding the Attendee User
Creating a new user in Keycloak involves setting up basic user information and credentials.
Let's create a new attendee user with these steps:
- Navigate to the Keycloak Admin Console at
localhost:1990 - Select the "event-ticket-platform" realm
- Go to Users and click "Add User"
- Fill in the following details:
- Username:
attendee - Email:
attendee@yourdomain.com - First Name:
attendee - Last Name:
user
- Username:
After creating the user, we need to set up their password:
- Go to the Credentials tab
- Set the password as "password" (Note: This is for development only)
- Disable the "Temporary" option to prevent password reset requirements
Creating and Assigning Roles
Roles in Keycloak help us manage user permissions effectively.
We'll create two roles:
ROLE_ATTENDEE // For regular event attendees
ROLE_ORGANIZER // For event organizersTo create these roles:
- Navigate to Realm Roles
- Click "Create Role"
- Enter
ROLE_ATTENDEEfor the first role - Repeat the process with
ROLE_ORGANIZER
Next, we'll assign these roles:
-
For the attendee user:
- Go to Users → attendee → Role Mapping
- Click "Assign Role"
- Select
ROLE_ATTENDEE
-
For the organizer user:
- Go to Users → organizer → Role Mapping
- Click "Assign Role"
- Select
ROLE_ORGANIZER
Summary
- Added the attendee user to Keycloak
- Added the
ROLE_ATTENDEErole to Keycloak - Added the
ROLE_ORGANIZERrole to Keycloak