Testing the Visual Studio Code extension for ALFA

Note: The following instructions assume a basic knowledge of the workflow in Visual Studio Code. Refer to the Visual Studio Code documentation for more information about the editor.

When the Visual Studio Code extension for ALFA has been installed, you can try it out.

  1. Open a project folder in VS Code.

  2. Create a new file and click to select ALFA as the language from the "Select a language" drop-down menu (or press Ctrl+K M).

    This tells VS Code to interpret the file as ALFA and evaluate the content using the ALFA language service.

  3. Save the file with the file extension ".alfa", for instance, "test.alfa". (The names "system" and "standard-attributes" are reserved for the VS Code extension for ALFA and cannot be used when naming the .alfa file. See below.)

    The file must be saved with the .alfa file extension for the compilation functionality to work.

    When a new file is saved with the .alfa file extension, two supporting files are copied to the working folder: "system.alfa" and "standard-attributes.alfa".

    The "system.alfa" file contains definitions for the standard XACML functions. The "standard-attributes.alfa" file contains attribute ID definitions for the standard attributes from the XACML specification.

  4. Enter the following text into the file test.alfa:

namespace test {
policy testpolicy {
target clause Attributes.subjectId == "alice"
apply permitOverrides
rule {
permit
}
}
}
  1. Save the test.alfa file.

The compiler should now have produced an XML file with an XACML policy in a subfolder called "src-gen". The generated file name follows the naming pattern "namespace.policy.xml".

Axiomatics
The Visual Studio Code extension for ALFA was developed by Axiomatics.
FOLLOW US