Create Custom EmpowerID Event Receivers
EmpowerID provides a number of hard-coded methods, known as EmpowerID event receivers, that are called during inventory and attribute flow processes, providing organizations with the ability to write custom code that allows them to respond to specific actions carried out against objects discovered by EmpowerID. For example, one of the EmpowerID event receivers is the ActiveDirectoryAccountChangedReceiver event receiver. This event receiver is called as a "last resort" each time EmpowerID inventories Active Directory. It is the final method before EmpowerID calls InventoryBulkUpdate(), which pushes any changes in external Active Directory accounts to the EmpowerID Identity Warehouse. The default implementation of the ActiveDirectoryAccountChangedReceiver event receiver, as well as the default implementation for all EmpowerID event receivers, does nothing more than write out a record stating they have been called. However, each of these event receivers can be custom-coded to do anything from sending notifications of changes to interested parties, to initiating specific workflows to accomplish tasks related to those changes, to providing a fail-safe for corrective action when undesired changes are discovered.
Each EmpowerID event receiver lives as an object on the EmpowerIDEventReceivers table of the Identity Warehouse (for a tabular view of all the default EmpowerID event receivers, see the EmpowerIDEventReceivers table at the end of this topic), with two special properties, among others, the ReceiverAdapterAssembly property that refers to the specific assembly and the ReceiverAdapterType property that refers to the specific assembly with the code that is to be executed when the event receiver is invoked. When custom coding an existing default event receiver in this way, you simply create and publish a custom class library in Workflow Studio, being sure to implement to appropriate interface for the event receiver in the class. You then update the ReceiverAdapterAssembly and ReceiverAdapterType properties for the EmpowerID event receiver record in the EmpowerIDEventReceivers table. When event receivers are called, they look for the assembly and class to execute therein. If you do not update these properties, your custom code will not be called.
When customizing EmpowerID event receivers, you must be sure to implement the appropriate interfaces for those event receivers for your customization to work in EmpowerID. These interfaces are baked in and cannot be changed.
When EmpowerID executes the ActiveDirectoryAccountChangedReceiver event receiver, it does so in the following way. (The process is the same for each default EmpowerID event receiver.)
In the following example, we create a class library in Workflow Studio, implementing the IAccountChangedReceiver interface. This allows us to add code to the Receive() method to perform any actions when the ActiveDirectoryAccountChangedReceiver event receiver is invoked. We then compile and publish the class library and update the ReceiverAdapterAssembly and ReceiverAdapterType properties for the event receiver.
EmpowerID calls the ActiveDirectoryAccountChangedReceiver.ExecuteReceiver() method, passing the collection of ExistingAccounts to the receiver. It does this right before the Account.InventoryBulkUpdate() method is called.
ExecuteReceiver(), in turn, calls the EmpowerID database to get the values of the ReceiverAdapterAssembly and ReceiverAdapterType properties.
ExecuteReceiver() then uses reflection to invoke the Receive() method implemented by the IAccountChangedReceiver interface. This method receives a collection of accounts.
The Receive() method executes any code for the event receiver. Organizations wishing to implement their own custom code would do so here. We demonstrate this below.
To customize the ActiveDirectoryChangedReceiver event receiver
In Workflow Studio, click on the application icon to open the application menu and select Extensibility > EmpowerID Class Library.
Â
Name the Class Library "Custom_ActiveDirectoryAccountChangedReceiver" and save it to the package of your choice.
Workflow Studio creates the class library and opens the C# Editor for it.Â
In the C# Editor for the class library, add code to the class declaration to implement the IAccountChangedReceiver interface.
public class Custom_ActiveDirectoryAccountChangedReceiver : TheDotNetFactory.Framework.ResourceManagement.IAccountChangedReceiver
In the C# Editor for the class library, add the following code to the OnProcessAlert() method (Comments have been added for clarity).
//Call the Receive() method of the IAccountChangedReceiver interface to return the collection of changed accounts public void Receive(TList<Account> changedObjects) { //Create a list of account objects E.VList<C.AccounView> accList = new E.VList<C.AccountView>(); //Add all changed objects to the list of account objects if(changedObjects.Count > 0) { foreach(var v in changedObjects) accList.Add(v); //Implement further code to work with the list as desired ... } }
Â
When ready, compile and publish the class library.
In SQL Server, update the ReceiverAdapterAssembly and ReceiverAdapterType properties accordingly for the event receiver.
The following table contains the EmpowerID Event Receivers available to you.
ID | Name | Description | Adapter Assembly | Adapter Type |
---|---|---|---|---|
1 | ActiveDirectoryDeletedObjectsDiscoveredReceiver | Receives all discovered deleted objects each time active directory inventory runs. Implements the IDeletedObjectsDiscoveredReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryDeletedObjectsDiscoveredReceiver |
2 | ActiveDirectoryContainerDiscoveredReceiver | Receives all discovered containers each time active directory inventory runs after the Locations are inserted in EmpowerID. Implements the IContainerDiscoveredReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryContainerDiscoveredReceiver |
3 | Active Directory Container Changed Receiver | Receives all modified containers each time active directory inventory runs before the Locations are updated in EmpowerID. Implements the IContainerChangedReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryContainerChangedReceiver |
4 | Active Directory Group Discovered Receiver | Receives all discovered groups each time active directory inventory runs after the Groups are inserted in EmpowerID. Implements the IGroupDiscoveredReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryGroupDiscoveredReceiver |
5 | Active Directory Group Changed Receiver | Receives all modified groups each time active directory inventory runs before the Groups are updated in EmpowerID. Implements the IGroupChangedReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryGroupChangedReceiver |
6 | ActiveDirectoryAccountDiscoveredReceiver | Receives all discovered accounts each time active directory inventory runs after the Accounts are inserted in EmpowerID. Implements the IAccountDiscoveredReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryAccountDiscoveredReceiver |
7 | ActiveDirectoryAccountChangedReceiver | Receives all modified accounts each time active directory inventory runs before the Accounts are updated in EmpowerID. Implements the IAccountChangedReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryAccountChangedReceiver |
8 | ActiveDirectoryExchangeMailboxDiscoveredReceiver | Receives all discovered exchange mailboxes each time active directory inventory runs after the Exchange Mailboxes are inserted in EmpowerID. Implements the IExchangeDiscoveredReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryExchangeMailboxDiscoveredReceiver |
9 | ActiveDirectoryExchangeMailboxChangedReceiver | Receives all modified exchange mailboxes each time active directory inventory runs before the ExchangeMailboxes are updated in EmpowerID. Implements the IExchangeMailboxChangedReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryExchangeMailboxChangedReceiver |
10 | ActiveDirectoryComputerDiscoveredReceiver | Receives all discovered computers each time active directory inventory runs after the Computers are inserted in EmpowerID. Implements the IComputerDiscoveredReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryComputerDiscoveredReceiver |
11 | ActiveDirectoryComputerChangedReceiver | Receives all modified computers each time active directory inventory runs before the Computers are updated in EmpowerID. Implements the IComputerChangedReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryComputerChangedReceiver |
12 | ActiveDirectoryExchangePublicFolderDiscoveredReceiver | Receives all discovered exchange public folders each time active directory inventory runs after the Exchange Public Folders are inserted in EmpowerID. Implements the IExchangePublicFolderDiscoveredReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryExchangePublicFolderDiscoveredReceiver |
13 | ActiveDirectoryExchangePublicFolderChangedReceiver | Receives all modified exchange public folders each time active directory inventory runs before the ExchangePublicFolders are updated in EmpowerID. Implements the IExchangePublicFolderChangedReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryExchangePublicFolderChangedReceiver |
14 | ActiveDirectoryLyncUserDiscoveredReceiver | Receives all discovered lync users each time active directory inventory runs after the lync users are inserted in EmpowerID. Implements the ILyncUserDiscoveredReceiver interface. | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryLyncUserDiscoveredReceiver |
15 | ActiveDirectoryLyncUserChangedReceiver | Receives all modified lync users each time active directory inventory runs before the LyncUsers are updated in EmpowerID. Implements the ILyncUserChangedReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ActiveDirectoryLyncUserChangedReceiver |
16 | ADAMDeletedObjectsDiscoveredReceiver | Receives all discovered deleted objects each time ADAM inventory runs. Implements the IDeletedObjectsDiscoveredReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ADAMDeletedObjectsDiscoveredReceiver |
23 | ADAMContainerDiscoveredReceiver | Receives all discovered containers each time adam inventory runs after the Locations are inserted in EmpowerID. Implements the IContainerDiscoveredReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ADAMContainerDiscoveredReceiver |
24 | ADAMContainerChangedReceiver | Receives all modified containers each time adam inventory runs before the Locations are updated in EmpowerID. Implements the IContainerChangedReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ADAMContainerChangedReceiver |
25 | ADAMGroupDiscoveredReceiver | Receives all discovered groups each time adam inventory runs after the Groups are inserted in EmpowerID. Implements the IGroupDiscoveredReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ADAMGroupDiscoveredReceiver |
26 | ADAMGroupChangedReceiver | Receives all modified groups each time adam inventory runs before the Groups are updated in EmpowerID. Implements the IGroupChangedReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ADAMGroupChangedReceiver |
27 | ADAMAccountDiscoveredReceiver | Receives all discovered accounts each time adam inventory runs after the Accounts are inserted in EmpowerID. Implements the IAccountDiscoveredReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ADAMAccountDiscoveredReceiver |
28 | ADAMAccountChangedReceiver | Receives all modified accounts each time adam inventory runs before the Accounts are updated in EmpowerID. Implements the IAccountChangedReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.ActiveDirectory.ADAMAccountChangedReceiver |
29 | LdapDeletedObjectsDiscoveredReceiver | Receives all discovered deleted objects each time Ldap inventory runs. Implements the IDeletedObjectsDiscoveredReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.Ldap.LdapDeletedObjectsDiscoveredReceiver |
30 | LdapContainerDiscoveredReceiver | Receives all discovered containers each time Ldap inventory runs after the Locations are inserted in EmpowerID. Implements the IContainerDiscoveredReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.Ldap.LdapContainerDiscoveredReceiver |
31 | LdapContainerChangedReceiver | Receives all modified containers each time Ldap inventory runs before the Locations are updated in EmpowerID. Implements the IContainerChangedReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.Ldap.LdapContainerChangedReceiver |
32 | LdapGroupDiscoveredReceiver | Receives all discovered groups each time Ldap inventory runs after the Groups are inserted in EmpowerID. Implements the IGroupDiscoveredReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.Ldap.LdapGroupDiscoveredReceiver |
33 | LdapGroupChangedReceiver | Receives all modified groups each time Ldap inventory runs before the Groups are updated in EmpowerID. Implements the IGroupChangedReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.Ldap.LdapGroupChangedReceiver |
34 | LdapAccountDiscoveredReceiver | Receives all discovered accounts each time Ldap inventory runs after the Accounts are inserted in EmpowerID. Implements the IAccountDiscoveredReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.Ldap.LdapAccountDiscoveredReceiver |
35 | LdapAccountChangedReceiver | Receives all modified accounts each time Ldap inventory runs before the Accounts are updated in EmpowerID. Implements the IAccountChangedReceiver interface | TheDotNetFactory.Framework, | TheDotNetFactory.Framework.ResourceManagement.Managers.Ldap.LdapAccountChangedReceiver |
36 | Management RAccountObjectAttributeInboxCreatedReceiver | Receives all inbox attributes that are coming from a change in an external Account Store that should be synchronized to the EmpowerID Person before it gets added to the inbox to be processed. It returns all the attributes that need to be added. Implements the IAccountInboxReceiverCreatedReceiver interface | TheDotNetFactory.Framework.People.Components, | TheDotNetFactory.Framework.People.InboxManagers.AccountObjectAttributeInboxCreatedReceiver |
37 | AccountObjectAttributeOutboxCreatedReceiver | Receives all inbox attributes that are coming from a change in the EmpowerID Person that should be synchronized to and external account before it gets added to the outbox to be processed. It returns all the attributes that need to be processed. Implements the IAccountOutboxReceiverCreatedReceiver interface | TheDotNetFactory.Framework.People.Components, | TheDotNetFactory.Framework.People.InboxManagers.AccountObjectAttributeOutboxCreatedReceiver |
38 | AccountInboxReceivedReceiver | Receives all accounts that will be processed by the account inbox before being provisioned, joined or ignored. It returns all the accounts that need to be processed. Implements the IAccountInboxReceivedReceiver interface | TheDotNetFactory.Framework.People.Components, | TheDotNetFactory.Framework.People.InboxManagers.AccountInboxReceivedReceiver |
39 | AccountInboxJoinedReceiver | Receives all accounts that have been joined by the account inbox. Implements the IAccountInboxJoinedReceiver interface | TheDotNetFactory.Framework.People.Components, | TheDotNetFactory.Framework.People.InboxManagers.AccountInboxJoinedReceiver |
41 | AccountInboxProvisionedReceiver | Receives all accounts that have been provisioned by the account inbox. Implements the IAccountInboxProvisionedReceiver interface | TheDotNetFactory.Framework.People.Components, | TheDotNetFactory.Framework.People.InboxManagers.AccountInboxAccountsToProvisionReceiver |
42 | AccountInboxAccountsToProvisionReceiver | Receives all accounts that will be provisioned as new people by the account inbox before being provisioned. It returns all the accounts that need to be processed. Implements the IAccountInboxAccountsToProvisionReceiver interface | TheDotNetFactory.Framework.People.Components, | TheDotNetFactory.Framework.People.InboxManagers.AccountInboxAccountsToProvisionReceiver |
43 | AccountInboxPeopleToProvisionReceiver | Receives all empowerid person entries that will be provisioned as new people by the account inbox before being provisioned. It returns all the people that need to be processed. Implements the IAccountInboxPeopleToProvisionReceiver interface | TheDotNetFactory.Framework.People.Components, | TheDotNetFactory.Framework.People.InboxManagers.AccountInboxPeopleToProvisionReceiver |
44 | AccountInboxAccountsErrorReceiver | Receives all accounts that had an error while being joined or processed and returns them. Implements the IAccountInboxAccountsErrorReceiver interface | TheDotNetFactory.Framework.People.Components, | TheDotNetFactory.Framework.People.InboxManagers.AccountInboxAccountsErrorReceiver |
45 | BusinessProcessCommentReceiver | Receives all business process comments added to a business process when a comment is made; it does not return anything. Implements the IBusinessProcessCommentReceiver interface | TheDotNetFactory.Framework.People.Components, | TheDotNetFactory.Framework.People.Components.BusinessProcessCommentEventReceiver |