public interface Configuration
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.
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
interfaces may declare members with the following primitive Java types
(and their boxed versions):
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 typeOptional<T>
where T is any other acceptable type, except List
and Optional
.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(); }
Modifier and Type | Method and Description |
---|---|
String |
id() |