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.

12801280

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Ā 
18381838
  • 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:

11401140

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:

11321132

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:

11361136

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);
11361136