Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

By default, EmpowerID retrieves attribute values for each user account in a connected account store and maps them value for value to the corresponding Person attributes stored in the EmpowerID Identity Warehouse. In this way, if the value of "State" for an external user account is "Massachusetts" then the value of "State" for that account's Person object in EmpowerID is "Massachusetts." However, EmpowerID allows you to create your own Attribute Flow Handlers to customize translate these values differently as needed for your scenarios. You do this by creating a class library in Workflow Studio that inherits from the DefaultAttributeflowHandler class and by overriding the method specific to the account store (external or EmpowerID) you wish to effect. These methods are as follows:. Methods to implement include the following:


  • ProcessInventoryChange – This method is called during inventory to populate the AccountObjectAttributeInbox and AccountObjectAttributeOutbox tables of the EmpowerID Identity Warehouse. This method calls the GetValueForPerson() and GetValueForAccount() methods and compares the values.
  • GetValueForPerson – blah
  • GetValueForAccount – blah
  • SetPersonAttribute – You override this method to customize how the attribute is set in EmpowerID.
  • ProcessPersonAttributeChange – You override this method to customize how the attribute is set in an external account store like AD.

In addition to creating the custom Attribute Flow Handler, you also redefine the Attribute Flow Assembly and Attribute Flow Type for the specific Security Boundary Attributes you are customizing, setting the values to that of the assembly that gets created when you publish the class library and that of the full name of your custom class. Once you have accomplished this, the next time attribute flow occurs, the affected values will be updated in the appropriate system.

In this article, we demonstrate how to create a custom Attribute Flow Handler that transforms the State attribute value contained in an external account store to the abbreviation for those states so that the abbreviated value appears as the State attribute value for the corresponding Person records in the EmpowerID Identity Warehouse. We demonstrate this by doing the following:

  • Creating a Attribute Flow Handler class library in Workflow Studio and adding code to the class library to:
    • Inherit from the DefaultAttributeflowHandler class
    • Override the SetPersonAttribute() method of the DefaultAttributeflowHandler class to abbreviate the State attribute for user accounts in the external system so that those attributes appear in the abbreviated form for each corresponding Person record in EmpowerID
    • Editing the State Security Boundary Attribute for EmpowerID in the EmpowerID Web interface

Info

As a best practice, class libraries are created in Workflow Studio and edited in Visual Studio. We follow this practice in this article.


To create a Custom Attribute Flow Handler

  1. In Workflow Studio, right-click on the folder in which you want to create the attribute flow handler and select New Extension or Library > Class Library (.NET Framework).

    Image Removed
    Image Added


    This opens the C# Editor for the class library.




  2. Click the Save button above the C# Editor and name the file appropriately.



  3. Close the class library project and then locate it in your source control tree.
  4. Double-click the project to open it Visual Studio.
  5. In Visual Studio, open the class library in the editor and add code to do the following:
    1. Inherit from TheDotNetFactory.People.Components.InboxManagers.DefaultAttributeflowHandler base class
    2. Override the SetPersonAttribute() method, passing in thePersonandAccountObjectAttributeInboxobjects as parameters. TheAccountObjectAttributeInboxobject is the class used for processing attributes that flow from external account stores to EmpowerID.


      The code should look similar to the following example. Please note that the name of your class will differ accordingly.

      Info

      When you create a class library, Workflow Studio automatically adds C= TheDotNetFactory.People.Components as a shorthand Using statement for TheDotNetFactory.People.Components namespace. This allows you to quickly reference the assembly in your code as "C."


      Code Block
      public class MyCustomAttributeFlowHandler: C.InboxManagers.DefaultAttributeflowHandler
      {
          public override bool SetPersonAttribute(Person person, AccountObjectAttributeInbox attributeInbox)
          {
      
          }
          }


  6. In the C# Editor for the custom Attribute Flow Handler, add code to the SetPersonAttribute() method do the following:
    1. Create a new instance of the SecurityBoundaryAttribute class, calling the GetPersonAttribute() method to return the attributes in the AccountObjectAttributeInbox
    2. Loop through the State attributes for each account, truncating the values for each to the abbreviated form for that state.
    3. Return the abbreviated form.

      The code for the above should look similar to the following.

      Code Block
      public class MyCustomAttributeFlowHandler : C.InboxManagers.DefaultAttributeflowHandler
      {
          public override bool SetPersonAttribute(Person person, AccountObjectAttributeInbox attributeInbox)
          {
              //Create new instance of SecurityBoundaryAttribute and call GetPersonAttribute() to return the attributes in the Attribute   Inbox
              SecurityBoundaryAttribute personAttribute =  SecurityBoundaryAttribute.GetPersonAttribute(attributeInbox.ObjectAttributeID);
              
              //Create variable to hold the results           
              var state = attributeInbox.StringValue;
      
              //Loop through the State attributes and abbreviate each 
              switch (state)
              {
                  case "Massachusetts":
                  state = "MA";
                  break;
      
                  case "Missouri":
                  state = "MO";
                  break;
      
                  case "New York":
                  state = "NY";
                  break;
      
                  case "Texas":
                  state = "TX";
                  break;
      
                  default:
                  state = null;
                  break;
              }
      
              //Return state
              return person.SetAttributeValue(personAttribute.Name, state);   
          }
      }


  7. Next, build the solution to create .pub file for it on your machine. 

    You should see Workflow Studio successfully publish the file.


At this point, the class library is simply published to your local file system. In order to make it available to users in the EmpowerID Web application, you need to run the PublishWorkflowStudioItem workflow in the Web application.

Publish the class library to your environment

  1. Log in to the EmpowerID web application as a user with the appropriate access to run the PublishWorkflowStudioItem workflow.
  2. On the navbar, expand Object Administration > Workflows and click the Publish Workflow Studio Item action link.

  3. Image Removed

  4. Image Added



  5. Click Choose File, navigate to the _PublishedItems folder and select the pub file for the class library you just published and then click Submit.

    Image Modified
  6. Reset IIS.

Now that custom Attribute Flow Handler has been created and published, the next step is to instruct EmpowerID to use it for processing the State attributes found in the external account store. This is demonstrated below.


To edit the State Security Boundary Attribute for EmpowerID

  1. On the navbar of the EmpowerID Web interface, expand Admin > Applications and Directories and click Manage Schema.
  2. On the Schema page, select the Security Boundary Attributes tab and the click the drop-down arrow to the right of the Search button. This allows you to perform advanced searching.




  3. In the Advanced Search dialog that opens, enter State in the Name field and select EmpowerID from the Security Boundary Type drop-down.




  4. Click Search to load the grid with the attribute.
  5. From the grid, click the Edit button to the left of the State attribute.




  6. In the Edit dialog that appears, do the following:
    1. In the Custom Flow Handler field, enter the full name of the class library you created. This should be similar to TheDotNetFactory.Framework.ClassLibrary.CustomAttributeFlowHandler where CustomAttributeFlowHandler is the name of your class library.
    2. In the Attribute Flow Assembly field, enter the name of the Attribute Flow assembly you just created above, followed by the version number, Culture, and PublicKeyToken information as comma separated values. This entry should look similar to CustomAttributeFlowHandler, Version=4.0.180.1, Culture=neutral, PublicKeyToken=2d2253f74d4496ef where CustomAttributeFlowHandler and Version=4.0.180.1 is the respective name and version number of the assembly in your environment.




    3. Click Save.

Testing the custom attribute handler

To test the custom attribute handler, create a new test user account in the target account store with an EmpowerID Person linked to that account and set the value of the State attribute to Massachusetts. If the handler is working correctly, during the next inventory run the value of the attribute should be transformed to MA on the EmpowerID Person.

  1. On the sidebar of the EmpowerID Web interface, expand Identity Administration and click People.
  2. Click the Create Person Advanced action link.




  3. From the General tab of the Create Person form that appears, enter the following information:
    • First Name – First name of the person
    • Last Name – Last name of the person
    • Login – Login of the person
    • Select a Role and Location – Click the link and set the primary Business Role and Location for the person to Temporary Role in Temporary Location.


      The General tab of the form should similar to the below image. 




  4. Click the Contact Information tab and select Massachusetts from the State drop-down.




  5. Click Save to create the new person.

After EmpowerID creates the person, you should see the State attribute reflecting the custom value.  You can view this in the Contact pane on the Person's ViewOne page.




Div
stylefloat: left; position: fixed; padding: 5px;
idtoc
classtopicTOC


Div
stylefont-size: 1rem; margin-bottom: -65px; margin-left: 40px;text-transform: uppercase;

On this page



Table of Contents
stylenone