Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

This feature is only available in the Enteprise version.

Furthermore, it is currently in PREVIEW state, so when if a product wants to use it, please refer support@onesaiplatform.com for activation.

Developing a custom Token Enhancer for the Identity Manager

Suppose you want to customize the way the JWT token is built at the Identity Manager.

New maven project

First of all, start by creating a new maven project on which you’ll develop the proposed functionality.

...

In order to guarantee 100% compatibility with the platform’s modules, version 1.5.9.RELEASE of Spring Boot and Java 1.8 should be used.

...

Developing the functionality

Let's start by creating a class that implements the interface TokenEnhancer on where we are going to add a simple property to the Oauth Access Token.

...

In this way, your enhancer will be applied as the last link of the Enhancer Chain, before building the final JWT token.

Build the JAR

For the Identity Manager to use the plugin, you’ll need to package the project into a JAR file, either with mvn clean install or mvn clean package

...

Please note that whatever the repository is, the file needs to be public, as the Identity Manager will try to download it without any kind of authentication.

Define the URI of the plugin in the Identity Manager (Oauth Server)

As the last step, you’ll need to let the module know where the plugin is, this is done by setting the environment variable PLUGIN_URI to the URI(s) where the JAR is located. In case there is more than one plugin, URIs must be separated with the character ';'

...

Now at the startup, the identity manager will attempt to find and load the plugins:

...

JWT Token: test

Finally, you can test your plugin by making a request to the Identity Manger and check for the new parameter that your Enhancer is adding.

Resources

View file
nameplugin-onesait-im.zip

...