Interface Configuration
- All Known Subinterfaces:
OneOf
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
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 these.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
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
PrecisionConstraintannotation. The default value is 10 digits.
- The double type is restricted to use the exact fraction precision
by
The following reference types are acceptable:
java.lang.String(non-empty Strings only; if an empty value would be acceptable, useOptional<String>instead).java.net.URIList<T>where T is any other acceptable type, exceptListandOptional. If T is another configuration interface, it may define a custom list key by annotating one of its members with the@ListKeyannotation. If no such annotation is provided, a list key will be automatically generated for the typeOptional<T>where T is any other acceptable type, exceptListandOptional.- Services provided by the server, as explained below.
Services
The server provides a number of services that can be used (and sometimes provided) by plugins. These services can be found in these.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
-
Method Details
-
id
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.
-