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).
Set up Keycloak
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):
- Restart Keycloak service:
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.
Set up Mail for Admin User on Keycloak
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).
![](https://divoc.digit.org/~gitbook/image?url=https%3A%2F%2F2562258420-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl6m0NhgP8h5hkr3DES7R%252Fuploads%252FQ6T3qHnzPuIXfQTFEreJ%252FScreenshot%25202023-02-14%2520at%252011.59.30%2520AM.png%3Falt%3Dmedia%26token%3Dfbf16027-58a1-47eb-9a86-a467793ff8ce&width=768&dpr=4&quality=100&sign=17653fc3&sv=1)
Test the connection to check if the email has been properly set up.
Create Tenant
Make a request to Keycloak with the client_credentials to generate a JWT, which will further be used to create tenants.
![](https://divoc.digit.org/~gitbook/image?url=https%3A%2F%2F2562258420-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl6m0NhgP8h5hkr3DES7R%252Fuploads%252FrJXaidp3aQnHyEWfi5PQ%252FScreenshot%25202023-02-14%2520at%252012.01.51%2520PM.png%3Falt%3Dmedia%26token%3D630501e6-78f2-4e77-a3b2-947290c8e6ef&width=768&dpr=4&quality=100&sign=b15a4462&sv=1)
![](https://divoc.digit.org/~gitbook/image?url=https%3A%2F%2F2562258420-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl6m0NhgP8h5hkr3DES7R%252Fuploads%252FzciVqkRin3d5DJ4nn17u%252FScreenshot%25202023-02-14%2520at%252012.03.30%2520PM.png%3Falt%3Dmedia%26token%3Dee772c93-fa0a-4f7c-81b9-9c71e22b5668&width=768&dpr=4&quality=100&sign=72856645&sv=1)
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.
![](https://divoc.digit.org/~gitbook/image?url=https%3A%2F%2F2562258420-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl6m0NhgP8h5hkr3DES7R%252Fuploads%252F3dPOQtP35Scsajz2FxRH%252FScreenshot%25202023-02-14%2520at%252012.05.59%2520PM.png%3Falt%3Dmedia%26token%3Dc6b76cd0-d331-4041-9363-8e07ed0f8bc5&width=768&dpr=4&quality=100&sign=90fe0a2f&sv=1)
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.
All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.
Last updated