Configuration

An Extension Point will typically need some user-supplied configuration.

For example: An extension point might reach out to an external service and query if the user on the registration request is still employed by the company. In this case the extension point might need an API URL and an API auth token.  The extension can specify configuration attributes it needs for its operation. 

Custom Configuration

Each Extension Point can specify configuration expected from the user. Once deployed, the Control Center will present an auto-generate configuration UI

To specify the configuration needed:

  • Extend Extension Point from the ConfigurableExtensionPoint class
  • Override the List getConfigAttributes() method to return a list of ExtensionConfigAttribute needed by the Extension
  • At runtime the server will invoke the setConfigAttributes(List config) method and pass the user-supplied config to the ExtensionPoint

🚧

Configuration is on a per-extension basis. If multiple RP Applications are associated with an extension, the same configuration is used across all of them.

Configuration across Multiple Extension Points

Each Extension Point can supply ExtensionConfigAttributes

All attributes from the all the ExtensionPoints in an Extension are aggregated on the UI
Each Extension Point is provided with all the config attributes on the setConfigAttributes().
This allows us to capture common config only once.

1280

Updating Configuration via Control Center UI

Once the extension is deployed successfully, it can be configured via the Control Center UI

  • Navigate to Settings > Intelligent Extensions 
  • Click the pencil edit icon
  • Fill in configuration and save 
1838
  • The config is passed to the extension and saved in the DB
  • The extension will receive this configuration on subsequent extension restarts

Configuration Attribute

Configuration is supplied by overriding the List getConfigAttributes() in the ConfigurableExtensionPoint interface

Each instance of ExtensionConfigAttribute in the List is a configuration attribute

The code below explains the various attributes on the ExtensionConfigAttribute

ExtensionConfigAttribute {

    private String name;
    private Object value;
    private ExtensionConfigAttributeType type = ExtensionConfigAttributeType.STRING;
    private Object defaultValue = null;
    private String description = "";

    /**
     * Is this confidential info? Example a password or API token
     */
    private Boolean sensitive = false;

    /**
     * Is this attribute not supplied in its entirety for security reasons?
     * Users are able to update redacted attributes by setting this to false on the update request
     */
    private Boolean redacted = false;

    private Boolean required = true;

    /**
     * Indicates more granular config, typically shown in an advanced section
     */
    private Boolean advancedConfig = false;

    /**
     * An array containing the list of values allowed for the parameter.
     * Can be used to display a dropdown selection
     */
    private List<String> allowedValues = null;

    /**
     * A regular expression that represents the patterns to allow for _String_ type
     */
    private Pattern allowedPattern = Pattern.compile(".*");

    /**
     * A numeric value that determines the smallest _numeric_ value you want to allow for Number types.
     */
    private Integer minValue = null;

    /**
     * A numeric value that determines the largest _numeric_ value you want to allow for Number types.
     */
    private Integer maxValue = null;

    /**
     * Any additional metadata to tbe passed on to the reciever
     */
    private Map<String, String> metadata = new HashMap<>(); 
}

Sample Configuration

String

ExtensionConfigAttribute serviceUrl = new ExtensionConfigAttribute();
serviceUrl.setName(SERVICE_ENDPOINT_PARAM.name());
serviceUrl.setDescription("REST API endpoint for  service");
serviceUrl.setDefaultValue("https://sample.com/api/");

// Inidicate mandatory
serviceUrl.setRequired(true);   

// This defines the type
serviceUrl.setType(STRING);

The above snippet is rendered on the Control Center UI as:

1140

Number

ExtensionConfigAttribute failThreshold = new ExtensionConfigAttribute();
failThreshold.setName(FAIL_THRESHOLD_PARAM.name());
failThreshold.setDescription("Number of breaches to allow before stopping registration");
failThreshold.setMinValue(5);
failThreshold.setMaxValue(50);
failThreshold.setType(NUMBER);

The above snippet is rendered on the Control Center UI as:

1132

Boolean

ExtensionConfigAttribute warnOnly = new ExtensionConfigAttribute();
warnOnly.setName(WARN_ONLY_PARAM.name());
warnOnly.setDescription("Only log warning instead of failing the registration");
warnOnly.setRequired(true);
warnOnly.setDefaultValue("false");
warnOnly.setType(BOOLEAN);

The above snippet is rendered on the CC UI as:

1136

Multiple choice

ExtensionConfigAttribute country = new ExtensionConfigAttribute();
country.setName(COUNTRY_PARAM.name());
country.setDescription("Check for breaches in this Country");

// This indicates multiple choice attribute
country.setAllowedValues(Arrays.asList("US", "UK", "AUS", "CAN", "MEX", "RUS", "IND"));

country.setDefaultValue("US");
country.setType(STRING);
1136