https://github.com/curityio/long-lived-token-procedure-plugin
A demo token procedure plugin capable of changing the refresh token output based on input parameters.
https://github.com/curityio/long-lived-token-procedure-plugin
long-lived plugin token-procedure
Last synced: about 2 months ago
JSON representation
A demo token procedure plugin capable of changing the refresh token output based on input parameters.
- Host: GitHub
- URL: https://github.com/curityio/long-lived-token-procedure-plugin
- Owner: curityio
- License: apache-2.0
- Created: 2023-02-21T11:17:49.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-16T06:56:40.000Z (about 2 years ago)
- Last Synced: 2025-01-30T13:31:25.039Z (4 months ago)
- Topics: long-lived, plugin, token-procedure
- Language: JavaScript
- Homepage: https://curity.io/resources/learn/long-lived-tokens-on-refresh/
- Size: 271 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Long-Lived Tokens Procedure Plugin
[](https://curity.io/resources/code-examples/status/)
[](https://curity.io/resources/code-examples/status/)A token procedure plugin that adds custom behavior to the refresh token endpoint.
The plugin adds the following two features to the refresh token endpoint:
- If the request to the endpoint contains the query parameter `long_lived_token` with value set to `true`, then the new access token is issued for a duration set in the plugin's configuration, instead of the value set for the given client.
- If the client has a property `id_token_on_refresh` set to `true`, then an ID token will be issued together with the response to the refresh token request.## Building the Plugin
Build the plugin by issuing the command `mvn package`. This will produce a JAR file in the `target` directory, which can be installed.
## Installing the Plugin
To install the plugin after building, copy the contents of `/target/` to `${IDSVR_HOME}/usr/share/plugins/longlivedtokenprocedure`, on each node of
the Curity Identity Server, including the admin node.For more information about installing plugins, refer to the [curity.io/plugins](https://support.curity.io/docs/latest/developer-guide/plugins/index.html#plugin-installation).
## Required Dependencies
For a list of the dependencies and their versions, run `mvn dependency:list`.
If you modify this plugin and add any `runtime` or `compile` scope dependencies, then ensure that all of these are installed in the plugin group. Otherwise, they will not be accessible to this plug-in and run-time errors will result.
## Configuring the Plugin
The plugin has the following configuration options:
- `Long-Lived Access Token Expiration` — the Time To Live for a long-lived access token, in seconds. Defaults to 4 hours.
- `Access Token Issuer` — a custom access token issuer. The default issuer is used if none provided.
- `Refresh Token Issuer` — a custom refresh token issuer. The default issuer is used if none provided.
- `ID Token Issuer` — a custom ID token issuer. The default issuer is used if none provided.## Enabling the Plugin
To enable the plugin using the admin UI go to your **Token Service** profile, then **Endpoints**. Locate the endpoint with type `oauth-token` and click on the `Flows` dropdown. Click on the dropdown under the `Refresh` flow and select **+ New Plugin**.

Give the plugin a name, and select the "Long Lived Token on Refresh" plugin tile.

You can then change the configuration option for the plugin. Once this is adjusted, commit the changes. The plugin will now be run when you call the refresh token endpoint.

You can manage your token procedure plugins by going to the **System** tab, then choosing **Token Procedure Plugins** from the sidebar menu.
## Running Tests
See [TEST.md](/TEST.md) for options on running the test suite for this plugin.
## More Information
Please visit [curity.io](https://curity.io/) for more information about the Curity Identity Server.