Hello,
I think the role based approach described by CR is indeed simplier in your case, if you don't want to fiddle with Keycloak too much .
It could be implemented as follows:
1) Realm role "unconfirmed"
Define a realm role named "unconfirmed", configure the "unconfirmed" role as default role (for new users).
-> If a new user registers in realm, keycloak will automatically assign the unconfirmend role.
2) Expose role in token for app
Now, suppose you have a client for your app called "myclient", where you configured the role scope to expose the "unconfirmed" realm role in the token
(id or access token) if a user has it.
3) Detect "unconfirmed" role in token within your client app
If the newly registered user accesses "myclient", then the "client app" can obtain tokens for the user, e.g. via Authorization Code Flow.
The token that "myclient" will receive will now contain the "unconfirmed" realm role. Your app can now detect this role and show a
message to the user and perhaps disable some app functionality.
4) Trigger admin notification
In your backend you can then notify an admin about the new user.
The admin can then either manually remove the "unconfirmed" role from the user OR use the keycloak admin API to remove the role.
5) Notify the user
Optionally, notify the user that their account is now "confirmed", or let them simply try again after a while.
This approach is quite lightweight and can be implement without any Keycloak extensions.
However, the downside of this approach is that it results in a valid user account that can already do
self-service account management and potentially access other applications in the same realm.
Cheers,
Thomas