REMS can be extended with plugins in certain extension points.
The plugins are loaded dynamically from external code found in the specified file.
There should be a function defined in the plugin, that is called at the right time. The name of the function depends on the type of the extension point.
All the functions receive config
where the plugin's configuration is (from the config file). Also context
specific data
will be passed.
Certain types of libraries have been exposed to plugins. Please post an issue if you want more added.
Examples of plugins can be found in the resources/plugins
directory.
Take data
and do any kind of transformations to it and return the new data
.
Return the original data if nothing should be done.
(defn transform [config data]
...)
Processes the passed data
for side-effects, such as integration to another server using HTTP requests.
Returns the errors so an empty sequence (nil
or []
for example) should be returned if everything was good.
Any errors will prevent the possible next process from running.
In the case of a failure in processing of the same data
, the process will be retried again, so the implementation should be idempotent. A retry can also happen for a successful process, if a processing plugin configured after this plugin fails.
(defn process [config data]
...)
Validates the passed data
.
Returns the errors so an empty sequence (nil
or []
for example) should be returned if everything was good.
Any errors will prevent the possible next validation from running, and generally the action from happening (e.g. logging in).
(defn validate [config data]
...)
Next are all the current extension points and the function they expect to find in the plugin.
After logging in, after opening the OIDC token and potentially fetching the user info, allow transforming that data further. For example, a complex field can be parsed and the result stored in new fields.
Expects transform
function.
After logging in, after the user data is finalized, allow validating it to prevent invalid users from logging in.
Expects validate
function.
The first returned error will be shown to the user on an error page. It can have the keys:
:key
The translation key of the error message such as:t.login.errors/invalid-user
(possibly from extra translations provided).:args
Additional arguments for the message translation (%1
,%2
, ...) if any. These must be translation keys too.
After entitlements have been updated, the new entitlements can be processed, and for example updated to another system.
Expects process
function.
The function can implement a networked request to push the entitlements to another system entirely. Notify us in case there are desired features missing.