Interface Configuration

All Known Subinterfaces:
OneOf

public interface Configuration
Interface for Plugin configuration definitions.

All plugins must provide an interface that extends Configuration, representing its runtime configuration. This is done via a PluginDescriptor.

When the server starts, it loads all plugins, checking the validity of their descriptors, including the Configuration interface they provide. If they are valid, the server's configuration service will include the plugin's definitions, so server administrators may configure the installed plugins using the server's configuration interfaces (CLI, UI, XML descriptors).

An instance of the Configuration interface used by the plugin may be obtained by the plugin classes via constructor injection. This means that any concrete type provided by the plugin may take the Configuration interface as an argument to its constructor. The server will build an instance of the interface based on the current state of the server configuration. This instance is immutable. If the server's configuration is modified, a new instance of the Configuration interface will be created, and if any plugin service uses that, it will also be re-created.

Annotations Link icon

There are several annotations that may be used to add constraints or further information about the values provided for configuration (e.g. provide default values, descriptions, value constraints etc.). They are all located in the se.curity.identityserver.sdk.config.annotation package. When a constraint annotation is used on a member of the Configuration interface, its value will be validated by the configuration service and the configuration will only be accepted if all values are valid.

Configuration types Link icon

Configuration interfaces may declare members with the following primitive Java types (and their boxed versions):
  • boolean
  • int
  • long
  • double
    • The double type is restricted to use the exact fraction precision by PrecisionConstraint annotation. The default value is 10 digits.

The following reference types are acceptable:

  • java.lang.String (non-empty Strings only; if an empty value would be acceptable, use Optional<String> instead).
  • java.net.URI
  • List<T> where T is any other acceptable type, except List and Optional. If T is another configuration interface, it may define a custom list key by annotating one of its members with the @ListKey annotation. If no such annotation is provided, a list key will be automatically generated for the type
  • Optional<T> where T is any other acceptable type, except List and Optional.
  • Services provided by the server, as explained below.

Services Link icon

The server provides a number of services that can be used (and sometimes provided) by plugins. These services can be found in the se.curity.identityserver.sdk.service package.

To use a service, just declare a method in the plugin Configuration interface whose return type is the desired service.

For example, the following Configuration interface shows how a plugin may obtain an elsewhere configured HttpClient service:

 interface MyPluginConfiguration extends Configuration {

     HttpClient getHttpClient();

 }
 
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    id()
     
  • Method Details Link icon

    • id Link icon

      String id()
      Returns:
      the ID of the particular instance of this plugin. This is used by the server to be able to refer to the configuration of a particular instance of a plugin.