Comment on page
How to Configure a New Tenant?
In this section, we will go through the steps involved in a typical flow, starting from creating new tenants to enabling them to create schemas and verifiable credentials (VCs).
- Login to the Keycloak console (localhost/auth/admin) as admin (password: admin). If you are getting https required error while trying to access the Keycloak console, run the following commands to set the SSL requirement of external requests to NONE (Note: This should be reverted back once the https is set up and moved to production).
- Connect to the registry DB and run the following query (Postgres DB configured in the docker compose file):
update REALM set ssl_required='NONE' where id = 'master';
- Restart Keycloak service:
docker-compose -f docker-compose-vc-issuance.yml up -d --build --no-deps keycloak
- The Sunbird-RC realm must have already been created due to the volume mounting of the realm file in the docker compose file.
- Click on Clients in the configure section on the left pane and click on admin-api.
- Go to the credentials tab. Click on Regenerate Secret and copy the new secret.
- Change the sunbird_sso_admin_client_secret to the copied secret in the docker-compose-vc-issuance.yml.
- Rebuild and restart the registry service that uses sunbird_sso_admin_client_secret.
docker-compose -f docker-compose-vc-issuance.yml up -d --build --no-deps vc-registry
This step can be skipped during the development phase and user activation can be directly done in Keycloak. The following section explains how that can be done: The admin user can create tenants using the token generated with client-credentials of the admin-api. When a tenant is created, Keycloak should send out an email to the tenant user id (email id of tenant). The email account should be configured to the Keycloak admin user.
- Click on the ‘Admin’ username at the top right corner, select “manage account” >> “Personal Info” and update the first name, the last name, and the email address in the admin user profile.
- Go back to the Sunbird-RC realm page. Navigate to the ‘Email’ tab in the “realm-settings” section.
- Update the email configuration with smtp address, host, email address and password (The app password should be used in the password field, which can be obtained after setting up your email to send emails via third-party applications).
- Test the connection to check if the email has been properly set up.
- Make a request to Keycloak with the client_credentials to generate a JWT, which will further be used to create tenants.
- Create a tenant using the token received in the above step, with the userId as the email Id of the tenant. This creates a tenant with the default password: abcd@123.
- The tenant account can either be:- Enabled/activated using the tenant portal (localhost) by setting up a new password and email confirmation,
- (or)- Navigate to the Keycloak UI users section in the Sunbird-RC realm and select the tenant user created. Toggle the “Email Verified” button to ‘ON’ and empty the “Required user actions” and save.