Multi-tenant Sign On

In this Lesson

In this lesson you will learn how to add multi-tenant support to the sample sign on process provided by Soiree.

Concepts

The sample sign on process provided by Soiree supports multi-tenant but does not expose it by default. To enable multi-tenant sign on you must do 2 things

  1. Add the tenant ID to the sign on scene
  2. Require the tenant ID to be entered

The following exercises will add multi-tenant support to the Party Pool solution.

Ensure the Tenant code source is installed

Before we begin the actual customization we need to ensure we have all the resources needed by this exercise.

Soiree includes a code source which provides a list of tenants. We will be using this list to allow users to select their tenant.

  1. Right click on the Party project in the package explorer and select the Soiree Project Configuration option
  2. The Soiree Items may appear like this



    If it does then click on the button to see what is installed. If it does not then proceed to step 3.



    Does the tenant code source appear in your list of installed items?

    • If it does then you may proceed to the Customize the Sign On Agent section of this lesson
    • If it does not then you must upgrade the Soiree plugin to the latest version and then reattempt to install the item.
  3. If the Soiree Items appears like this



    then click on the button to see what is not installed.



    Does the tenant code source appear in your list of uninstalled items?

    • If it does then press the Update button to install it.
    • If it does not then you must upgrade the Soiree plugin to the latest version and then reattempt to install the item.

After the tenant code source is installed you may proceed with this lesson.

Customize the Sign On Agent

You will now modify the Signon agent to use the code source and to require a tenant to be selected.

Add a code list to support tenant selection in the scene

  1. Open the Signon agent item



  2. Click on the Nodes tab



  3. Modify the tenant node definition to look like this



  4. Build the Signon agent



Require the tenant to be provided

  1. Open the Signon agent



  2. Add the following code to the top of the processEventAuthenticate method
    if (scheme.getTenant() == null)
    	scheme.getTenantNode().setMessage(error("You must select an organization"));
    

    The method should now begin with three validations as shown here



  3. Save the Signon agent

Customize the Sign On Scene

The words tenant, or multi-tenant may be a bit too bizarre for most people. We suggest you call the tenant ID something more appropriate as is demonstrated in this lesson.

  1. Open the Signon scene
  2. Modify layer 1 to look like this. The combo box defaults to displaying the description only – so the tenant name will be displayed in this field.



  3. Change the initial keyboard focus to land in the organization field



  4. Bind the agent’s tenant node to the combo list



  5. Modify layer 2 to look like this.



  6. Change the initial keyboard focus to land in the organization field



  7. Bind the agent’s tenant node to the combo list



  8. Save the Signon scene
Danger
The design we are providing here is not appropriate for all security needs. This design exposes the name of each tenant organization for the whole world to see and that would not be appropriate for some security scenarios. We have chosen this approach so we can demonstrate the use of the tenant code source.

You need to decide whether you can allow organization names to be published in this way. There are at least three ways to do anything – so here a few more

#1 Use a text field and have the user enter their organization ID (tenant ID).

#2 User the combo-box to display the tenant ID instead of the tenant name.

#3 Create a separate sign on scene for each tenant.

Test Multi-tenant sign on

  1. Start Derby and SxServer if they are not running
  2. Start the PartyPool solution
  3. The keyboard focus should be owned by the organization field.
    Press the letter u on the keyboard and the combo list will respond by finding the first item in the list matching that letter



  4. Enter the following values and press OK. The organization should require the tenant to be entered.



  5. Provide the following values and press OK

    Organization: Universal Tenant
    User Id: admin
    Password: admin



    The sign on attempt should succeed.

Caution

If your solution actually uses multi-tenant then you probably want to remove the Universal Tenant from the list of tenants because you want them to pick an actual tenant, not the universal one.

How would you do that?

[ hint: look at the tenant node definition in the Signon agent ]
That’s all for this lesson.