Obtaining the Calling User’s GUID

BPMTestApplication obtains the user’s GUID when they log in.

Every TIBCO ActiveMatrix BPM user is identified by a Global Unique IDentifier (GUID). This GUID is needed to identify a user when calling various API operations - for example, to display a work list.

The GUID can be obtained using the lookupUser operation from the EntityResolverService.

Procedure

  1. The Main method (in BPMTestApplication.cs) creates a new loginForm object, which displays the LoginForm dialog in which the user can enter a name and password.
    class BPMTestApplication
    {
       public static void Main()
       {
          LoginForm loginForm = new LoginForm();
          DialogResult result = loginForm.ShowDialog();
          if (result == DialogResult.OK)
          {
             Adapter _adapter = loginForm.ProxyAdapter;
             string _guid = loginForm.Guid;
             WorkList workList = new WorkList(_adapter,_guid);
             workList.ShowDialog();
          }
       }
    }
  2. The button1_Click method on the loginForm class (defined in LoginForm.cs):
    1. creates a new Adapter object, passing the data collected in the LoginForm dialog.
    2. calls the getGUID method on the ProxyAdapter object to obtain the GUID associated with that username.
      private void button1_Click(object sender, EventArgs e)
      {
         // Gather the information required from the various fields
         // Now call into our adapter, to make the "login"
         try
         {
            ProxyAdapter = new Adapter(usernameBox.Text, passwordBox.Text, hostBox.Text, portBox.Text, useHTTPS.Checked);
            Guid = ProxyAdapter.GetGUID(usernameBox.Text);
           // Login worked, return the LoginCredentials object which will be used later
            DialogResult = DialogResult.OK;
            Hide();
         }
         catch (Exception ex)
         {
            // Login failed, display an error dialog with the information
            MessageBox.Show(this, "Error logging in: " + ex.Message, "Error");
         }
      }
      Note: If a login failure occurs, it indicates that the user name or password included in the SOAP header has been rejected by TIBCO ActiveMatrix BPM LDAP authentication.

      Although BPMTestApplication uses GetGUID to handle the user’s login, it is important to realize that GetGUID is not being used to authenticate the user’s credentials.

  3. GetGUID (defined in Adapter.cs) obtains the GUID by invoking the lookupUser operation.
    public string GetGUID(string resource)
    {
       EntityResolverServiceClient entityClient = _handler.GetEntityResolverClient();
       lookupUser user = new lookupUser();
       user.name = resource;
       user.getdetail = true;
       lookupUserResponse response = entityClient.lookupUser(user);
       return response.detail[0].guid;
    }
  4. The GUID is passed back up to Main, from which it is used to obtain the user’s worklist.
    class BPMTestApplication
    {
       public static void Main()
       {
          LoginForm loginForm = new LoginForm();
          DialogResult result = loginForm.ShowDialog();
          if (result == DialogResult.OK)
          {
             Adapter _adapter = loginForm.ProxyAdapter;
             string _guid = loginForm.Guid;
             WorkList workList = new WorkList(_adapter,_guid);
             workList.ShowDialog();
          }
       }
    }