Tools for authoring ALFA policies
Enforcer provides plugins for some popular editors in order to assist in authoring ALFA policies.
Plugins currently exist for:
All plugins have the following features:
- Syntax highlighting
- Error highlighting & diagnostics
Visual Studio Code
The Visual Studio Code extension requires .Net Core 3.1 be installed in order to function. Download here. Install the Alfa Language Support extension either directly from the Visual Studio Marketplace, or search for the Alfa Language Support extension in the Extensions Manager within Visual Studio Code.
The extension will activate when opening a file with the .alfa
extension, or when selecting Alfa from the languages dropdown.
Visual Studio
The Visual Studio extension requires .Net Core 3.1 be installed in order to function. Download here. Install the Alfa Language Support extension either directly from the Visual Studio Marketplace, or search for the Alfa Language Support extension in the Manage Extensions window within Visual Studio.
The extension will activate when opening a file with the .alfa
extension.
Online Editor
There is an online demo editor capable of editing, compiling and executing ALFA policies, ideal for quickly trying things out in the browser. The editor consists of three main components: * Text editor pane * Attributes pane * Diagnostics and output pane
Text editor pane
The text editor pane provides syntax highlighting for ALFA code, and marks any error diagnostics with red underlines. The ALFA is compiled whever the text content changes, output from the compilation will be shown in the attributes and output panes.
Above the text editor are options to control the editor presentation.
Attributes pane
The attributes pane provides a way to configure values for the attributes used in your ALFA code, enabling the policies to be executed.
Attributes are added by selecting the desired attribute from the dropdown, providing a value and pressing Add. Repeating this process for the same attribute multiple times will create a collection of values for the same attribute. To remove a value for an attribute, press the cross next to the value.
The 'Show all attributes' button will change the list of attributes available in the dropdown. By default, only attributes that are referenced in the policy are shown.
Above the attribute pane is a dropdown to select the target policy to execute, and a 'Run' button to execute the chosen policy. The 'Run' button will be enabled provided there are no compilation errors in the diagnostics pane. The outcome from executing the policy will be shown in the output pane.
Diagnostics and Output pane
The diagnostics tab shows compilation errors and warnings for the ALFA in the text editor. The error locations are clickable links which will jump to the appropriate point in the ALFA.
The output tab shows the results of executing a policy, broken into the following sections.
Outcome The overall outcome from evaluating the policy. Permit, Deny, or Indeterminate.
Diagnostics A diagnostic trace of the evaluation. This includes policy heirarchy, rules, conditions, and requested attribute values.
Errors Any runtime errors will be listed here. Typically this would indicate missing attribute values.
Obligations & Advice If the policies on the execution path have obligations or advice to fulfill, they will be listed here along with the values assigned to any attribute parameters.