A Keycloak SPI extension that enables invitation-only user registration with time-limited tokens.
- Generate time-limited invitation tokens via admin REST API
- Restrict user registration to invited users only
- Automatic token expiration and usage tracking
- Integration with Keycloak's form action workflow
- Invite-only registration for organizations
- Controlled user onboarding
- Temporary access grants
- Beta testing programs
- Keycloak 26.0.0 or higher
- Java 21 or higher
mvn clean install- Copy the generated JAR file from
target/keycloak-invite-registration-1.0-SNAPSHOT.jarto your Keycloak server'sprovidersdirectory - Restart Keycloak server
The extension automatically registers itself through Java SPI mechanism. No additional configuration is required.
- Navigate to Authentication → Registration → Bindings
- Add the "Registration Invite Gate" form action
- Configure as REQUIRED execution
The REST endpoint requires users to have the admin realm role to generate invitation tokens.
- Endpoint:
POST /admin/realms/{realm}/invites/generate - Authentication: Requires admin realm role
- Request: Optional JSON body with
groupPathandexpirationSeconds - Validation:
groupPathmust start with/andexpirationSecondsmust be positive - Response: JSON object with invitation details
curl -X POST \
http://localhost:8080/admin/realms/myrealm/invites/generate \
-H 'Authorization: Bearer <admin_token>' \
-H 'Content-Type: application/json' \
-d '{ "groupPath": "/invitees", "expirationSeconds": 604800 }'{
"token": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"realm": "myrealm",
"message": "Invitation token generated successfully",
"expirationTime": 1703123456789,
"used": false,
"groupPath": "/invitees"
}mvn testmvn clean package# Build the project
mvn clean package
# Copy JAR to Keycloak providers directory
cp target/keycloak-invite-registration-1.0-SNAPSHOT.jar /path/to/keycloak/providers/
# Start Keycloak
/path/to/keycloak/bin/kc.sh startCurrently, the default expiration time is 24 hours and cannot be configured. Future versions may support configuration via Keycloak's configuration system.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.