HomeGuidesRecipesAPI
HomeGuidesAPILog In

Membership Providers have been inadequate for modern authentication. Forcing integrations to use custom HTTP modules and other approaches to get into the request pipeline to do redirects to other authentication systems.

This old mechanism has been replaced with Identity Extensions, allowing to define custom authentication modules to be developed and implemented where the built-in forms, LDAP, Basic, Windows, or SAML offerings do not provide a solution.
Usually, custom Identity Extensions point to a custom user base or attempt to offer a mixed-mode authentication where multiple checks are made against different systems.

An Identity Extension could not only authenticate users but manage their group subscriptions which control access to individual forms and administrator applications.

In the case that a different system needs to be notified or a more customised approach used, then an Escalation Extension can be built to handle the situation.

Identity Extension Development Walkthrough

The walkthroughs below have been created using Microsoft’s Visual Studio 2017. All sample code is based version 7.0 of the C# language and version 4.6 of the .NET Framework.

This walkthrough will show how to create a “SimpleEscalation” Escalation Extension – in this case, it will write a line in a text file on the server whenever the Escalation triggers.

  1. Open Visual Studio and create a new Class Library Project and give it a meaningful name. For this example, we will use SampleEscalationExtension. Ensure that the .NET Framework 4.6.2 is selected.
946
  1. Rename Class1 to something more meaningful such as SimpleEscalation.
322
  1. Click ‘Yes’ to the rename all references prompt.
464
  1. Add the following references to the project.
  • Intelledox.Extension.dll
  • Intelledox.Extension.Escalation.dll
  • Intelledox.QAWizard.dll
  • Intelledox.QAWizard.Design.dll
  • Intelledox.Model.dll

👍

Best Practice

  1. Reference Paths point to correct Intelledox Infiniti deployment path, usually located C:\inetpub\wwwroot\Infiniti\Produce\bin.
  2. Copy Local property should be set to False for all Intelledox Infiniti References, as this could corrupt your instance if an older reference is copied to an upgraded site.
1566

Reference Path

324

Copy Local = False

  1. Inherit from Intelledox.Extension.Escalation.EscalationExtension and override necessary EscalationExtension methods, as per the sample below.
using System;
using System.Threading.Tasks;
using Intelledox.Extension.Escalation;
using Intelledox.QAWizard;

namespace SampleEscalationExtension
{
  public class SimpleEscalation : EscalationExtension
  {
    public override ExtensionIdentity ExtensionIdentity
    {
      get => throw new NotImplementedException(); protected set => throw new NotImplementedException();
    }

    public override Task RunAsync(EscalationProperties properties)
    {
      throw new NotImplementedException();
    }

    public override bool SupportsRecurring()
    {
      throw new NotImplementedException();
    }
  }
}

👍

Build Successfully

The project should build at this point without error.

  1. Implement the ExtensionIdentity property so that it initializes the ExtensionIdentity object containing an Id and a Name to register the Escalation within Infiniti. The Id needs to be unique and the Name is displayed to the user in Design.
public override ExtensionIdentity ExtensionIdentity { get; protected set; }
= new ExtensionIdentity()
{
  Id = new Guid("3A9E90C7-2826-4C29-8641-6DE92D5D0F8D"),
  Name = "Infiniti Simple Escalation Extension"
};
  1. The SupportsRecurring() method defines whether or not this Escalation can run multiple times for a particular project. For this particular example, there is no reason why this can't run repeatedly.
public override bool SupportsRecurring()
{
  return true;
}

📘

Note

The Reassignment Escalation is an example of an Escalation which doesn’t support recurring – once the project has been assigned to somebody else, it can’t be reassigned to them again.

  1. The RunAsync() method defines what happens when the Escalation executes.
    For this example, the method is going to write “Hello World” and a timestamp to a file on the server.
public override async Task RunAsync(EscalationProperties properties)
{
  using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\temp\HelloWorld.txt", true))
  {
    await file.WriteLineAsync(DateTime.Now.ToString());
  }
}
  1. Build your Escalation to ensure it compiles without error. The Escalation can now be deployed and tested.

🚧

Scheduler

The directory the file is located in may need to change depending on the permissions on your server. The Infiniti Scheduler must have permission to write to the location specified, otherwise, the Escalation will fail.

Deploying an Escalation Extension

Escalation Extensions are deployed to an Infiniti environment by copying the Escalation Extension .dll file to the Scheduler bin directory and referencing it within Scheduler appsettings.json file.

  1. Locate your SampleEscalationExtension.dll file and copy it to the Scheduler root (usually located C:\inetpub\wwwroot\Infiniti\IntelledoxScheduler).

  2. Open the produce appsettings.json file and locate the “Extensions” section of the file.

  3. Add a new Escalation Extension element using the following syntax to the appsettings.json

"namespace, class AssemblyName"

Examle:

"Extensions": [
  "Intelledox.Extension.ActionBuiltin.PrintAction, Intelledox.Extension.ActionBuiltin",
  "Intelledox.Extension.ActionBuiltin.UserAction, Intelledox.Extension.ActionBuiltin",
  "Intelledox.Extension.ActionBuiltin.WebhookAction, Intelledox.Extension.ActionBuiltin",
  "Intelledox.Extension.ActionBuiltin.RESTAction, Intelledox.Extension.ActionBuiltin",
  "Intelledox.Extension.ActionBuiltin.OracleAction, Intelledox.Extension.ActionBuiltin",
  "Intelledox.Extension.ActionBuiltin.PushNotificationAction, Intelledox.Extension.ActionBuiltin",
  "Intelledox.Extension.EscalationBuiltin.EmailEscalation, Intelledox.Extension.EscalationBuiltin",
  "Intelledox.Extension.EscalationBuiltin.ReassignmentEscalation, Intelledox.Extension.EscalationBuiltin",
  "Intelledox.Extension.EscalationBuiltin.PushNotificationEscalation, Intelledox.Extension.EscalationBuiltin",
  "SampleStateExtensions.SimpleState, SampleStateExtensions"
],
  1. Save the appsettings.json file.
  2. Add this Escalation into a Workflow test project and make sure it creates a file in C:\temp\HelloWorld.txt as expected when escalation rules are met.

📘

More Examples

More examples are available in Intelledox Github account

Final Full Code

using System;
using System.Threading.Tasks;
using Intelledox.Extension.Escalation;
using Intelledox.QAWizard;

namespace SampleEscalationExtension
{
  public class SimpleEscalation : EscalationExtension
  {
    public override ExtensionIdentity ExtensionIdentity { get; protected set; }
    = new ExtensionIdentity()
    {
      Id = new Guid("3A9E90C7-2826-4C29-8641-6DE92D5D0F8D"),
      Name = "Infiniti Simple Escalation Extension"
    };
    // Main entry point in the escalation where it will perform its custom operations
    public override async Task RunAsync(EscalationProperties properties)
    {
      // Implement custom escalation details here. Send notifications, update services, etc
      using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\temp\HelloWorld.txt", true))
      {
        await file.WriteLineAsync(DateTime.Now.ToString());
      }
    }
    // Defines whether or not this escalation is allowed run multiple times for a particular project
    public override bool SupportsRecurring()
    {
      return true;
    }
  }
}