Microsoft Information Protection SDK - policy handler concepts

In the Policy SDK, mip::PolicyHandler exposes operations that compute policy actions and submit audit events.

Policy handler functions

mip::PolicyHandler exposes methods for reading, writing, and removing both labels and protection information. For the full list, consult the API reference.

This article covers the following methods:

  • ComputeActions
  • NotifyCommittedActions

Requirements

To create a PolicyHandler, provide:

  • A mip::MipContext
  • A mip::PolicyProfile
  • A mip::PolicyEngine added to the mip::PolicyProfile
  • A class that implements mip::PolicyHandler::Observer

Create a policy handler

The first step in obtaining policy actions is to create a PolicyHandler object. This class implements the functionality required to get the list of actions that a specific label requires. It also implements the function to trigger an audit event.

Create the PolicyHandler by calling the PolicyEngine's CreatePolicyHandlerAsync function by using the promise/future pattern.

CreatePolicyHandlerAsync accepts a single parameter: isAuditDiscoveryEnabled. Set this value to true if the application should surface heartbeat and discovery events in audit logging.

Note

Implement the mip::PolicyHandler::Observer class in a derived class because CreatePolicyHandler requires the Observer object.

auto createPolicyHandlerPromise = std::make_shared<std::promise<std::shared_ptr<mip::PolicyHandler>>>();
auto createPolicyHandlerFuture = createPolicyHandlerPromise->get_future();
PolicyEngine->CreatePolicyHandlerAsync(true);
auto handler = createPolicyHandlerFuture.get();

After you create the PolicyHandler object, you can compute actions and submit audit events.

Next steps

Now that you know how to create a policy handler, you can: