ActiveReports 12 Server User Guide
Create a Custom Security Provider
ActiveReports 12 Server User Guide > How To > Create a Custom Security Provider

You must create custom security providers in order to provide security filters for model entities. This allows you to add single sign-on functionality using LDAP and Active Directory, and to control access to data with row-level security.

Once you implement interfaces from the Extensibility assembly and configure the resulting assembly in the Administrator Dashboard by selecting it in the Security Provider list, you and your administrators can add security filters to entities when you edit a model. For more information, see Managing Single Sign-On Security Providers and Modifying an Entity topics.

You can use your UserContext attributes in the connection string of your data models by encasing them in percent signs. For more information, see Changing the Connection String topic.

To implement Extensibility interfaces in a .NET 3.5 Class Library

  1. In Visual Studio, create a new C# .NET Framework 3.5 Class Library project.
  2. From your ActiveReports 12 Server\Server installation folder, copy the ActiveReports.Server.Extensibility.dll file into your project's bin folder.
  3. In the Visual Studio Solution Explorer, right-click References and select Add Reference.
  4. In the Add Reference dialog that appears, on the Browse tab, look in the bin folder, select the ActiveReports.Server.Extensibility.dll and click OK.
  5. Add a class to your project that implements the ISecurityProvider interface, and another that implements the ISecurityProviderFactory interface.
    Note: For details on how to do this, please see the ActiveTunes.SecurityProvider sample in the C:\ActiveReports 12 Server\SDK\Samples directory.
    Important methods in the ISecurityProvider interface include:
    • CreateToken creates the security token that the server holds to identify the current logged in session with username and password parameters, as well as a custom parameter for any other credentials data used by the provider.
    • FilterRoles gets the collection of roles associated with the specified security token.
    • GetUserContext returns the UserContext object for the specified security token.
    • GetUserDescription returns two useful objects:
      • UserDescription.Email automatically fills the email field in the error log submission dialog.
      • UserDescription.FriendlyUserName automatically fills the CreatedBy and ModifiedBy fields for reports.
  6. Once all of the necessary classes are in place with your custom data, from the Build menu, select Build ClassLibrary1. A DLL is created in your project's bin folder.

To configure the provider

  1. In Windows Explorer, create a SecurityProviders folder on the same level as your site, for example, if you have C:\ActiveReports 12 Server, create the folder C:\ActiveReports 12 Server\SecurityProviders.
  2. Copy your custom security provider DLL file into the new folder.
  3. On the Administrator Dashboard, in the Configuration section, click Security Provider.
  4. From the Custom security provider drop-down that appears, select your new provider.
  5. Select values for any properties that may be available, depending on your provider.
  6. Click the Apply changes button.

To add a row-level security filter

  1. On the Administrator Dashboard, in the Administration section, click Models.
  2. In the list of models that appears, next to the model containing the entity that you want to filter, click the Edit command.
  3. In the model editor that appears, from the Entities list to the left, click the entity that you want to filter.
  4. In the workspace at the center, next to the Security Filter property, click the Add command.
  5. In the Edit Security Filter dialog that appears, select Filter Expression, and click the ellipsis button next to the box under that label.
  6. In the Select Attribute dialog that appears, expand nodes as necessary to select the attribute to which you want to apply a filter condition, and click OK.
  7. In the center, you can choose whether the attribute equals or does not equal the value to the right.
  8. In the drop-down box to the right, select the value from your security provider to compare to the attribute on the left.
  9. Click Apply to add the filter to the entity.
See Also