Plugin Resources#

All Curity SDK Plugins can provide the following types of resources (besides the plugin implementation code):

Resources are stored in the plugin’s jar file, under the following paths, respectively:

  • webroot/assets/
  • messages/
  • templates/
  • icons/

Source Directories#

Following Java conventions, resource files are normally stored in the src/main/resources source directory.

Therefore, to place a resource under the following path:

  • webroot/assets/my-plugin/foo.svg

There should be a source file at:

  • src/main/resources/webroot/assets/my-plugin/foo.svg

Most build tools allow configuring a different path for jar resources. Refer to your build tool documentation in case the location differs in your case, or if you want to customize it.

In the next sections, all paths from refer to the path within the plugin’s jar file, not the source resource directory.

Avoiding conflicts#

Notice that resources from all plugins are copied into the same output directory.

The directory var/.plugins/ is used as output directory. This is considered as an “internal” directory and the server may overwrite or even delete files in it, as it is not meant to be used directly by administrators.

For this reason, it is recommended that all resources should be placed in a path within the jar that is unique to each plugin.

For example:

  • webroot/assets/my-plugin/
  • messages/core/en/my-plugin/
  • templates/my-plugin/

This does not apply to icons because icons already have unique names that reflect each plugin implementation type, as explained in the Admin UI Icons section.

Plugin Assets#

Assets are static files which will be served by the Curity Identity Server without modifications. That normally includes images, stylesheets and JavaScript bundles and many more.

As an example, suppose a plugin wants to display an image from one of its pages. As mentioned above, assets must be placed under the webroot/assets/ path in the plugin’s jar file. Hence, the image could be added to the following location in the plugins’ jar file:

  • webroot/assets/my-plugin/my-image.png

In which case, it would be reachable from the following URL:

  • <base-url>/assets/my-plugin/my-image.png

Where <base-url> is the base URL where the Curity Identity Server is running.

A plugin template could then include an img tag that linked to that URL.

For details about web assets in general, see also Web Assets .

Templates#

A plugin may provide template views by including templates in the templates/ path of the plugin’s jar file..

For details about web templating in general, see also Understanding the Templating System .

Message Files#

Template views can include localized messages. Plugins may provide messages by including message files in the messages/ path of the plugin’s jar file..

For example, to provide English messages for a plugin called my-plugin, place messages in messages/core/en/my-plugin/messages.properties, following the messages directory layout.

For details about web Localization in general, see also Localizing Resources .

Admin UI Icon#

Plugins can be configured in the Curity Identity Server‘s Admin UI . An icon will be used wherever the plugin is configured.

HTML, NetID and OIDC Authenticators shown with icons.
Example Authenticators with icons in the Admin UI. (Admin UI version: 11.0)

To provide a custom icon, include an icon SVG file in the icons/<plugin-impl-type>.svg path of the plugin’s jar file, where:

  • <plugin-impl-type> is the plugin implementation type (as returned by its PluginDescriptor#getPluginImplementationType method).

For example, if a plugin implementation type is my-plugin, place the icon at the following location in the plugin’s jar file:

  • icons/my-plugin.svg

The SVG icon should have a squared 1:1 ratio.

If no icon is provided by a plugin, a generic icon is used.

Was this helpful?