@zerosubnet/directus-extension-external-jwt

1.0.8 • Public • Published

External JWT Plugin for Directus

This plugin serves as a way to make Directus trust externally signed JWT tokens from an OIDC or OAuth2 provider.

The plugin expects to resolve the following new configuration option

The provider must issues Access tokens as JWT since this is used for verification right now. Might add support for general tokens later.

If USEDB are enabled the extension will try to search for the user in the database by looking at the sub in the JWT token. The user must exists and all roles for that use will be used.

When using USEDB you should also enable the caching option to reduce the time spent against the api and reduce the number of db lookups. The cache stores the user object in the cache based on the sub in the token.

USEDB also validates that the issuer is the same as assigned to the user.

Configuration

all configuration options listed here are an extension to directus default config.

ENV Variable Supported values Description
AUTH_PROVIDER_TRUSTED True/False Must be true for the provider to be considered as trusted. Note, do not trust public providers as these can generate tokens that you cannot control.
AUTH_PROVIDER_JWT_ROLE_KEY String What key in the JWT payload contains the role
AUTH_PROVIDER_JWT_ADMIN_KEY String What key in the JWT payload contains a bool to grant admin rights
AUTH_PROVIDER_JWT_APP_KEY String What key in the JWT payload contains a bool to allow app access
AUTH_PROVIDER_JWT_USEDB Bool If enabled/true the plugin will resolve the user and roles from the directus database using the token. For OIDC the sub is used. Should not be used without a Redis Cache enabled.
CACHE_JWT_NAMESPACE String What namespace to use in cache store.
CACHE_JWT_TTL Number Time to live for the cached user entry, default 5000 (5 seconds)
REDIS_JWT_DB Number What database to use in Redis cache, default 2

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.835latest
1.0.9-beta.30beta

Version History

VersionDownloads (Last 7 Days)Published
1.0.9-beta.30
1.0.9-beta.20
1.0.9-beta.10
1.0.835
1.0.70
1.0.7-beta.10
1.0.6-beta.20
1.0.60
1.0.6-beta.10
1.0.5-beta.70
1.0.5-beta.60
1.0.5-beta.51
1.0.5-beta.40
1.0.5-beta.30
1.0.5-beta.20
1.0.5-beta.10
1.0.50
1.0.40
1.0.3-beta.70
1.0.30
1.0.3-beta.60
1.0.3-beta.50
1.0.3-beta.40
1.0.3-beta.30
1.0.3-beta.20
1.0.3-beta.10
1.0.20

Package Sidebar

Install

npm i @zerosubnet/directus-extension-external-jwt

Weekly Downloads

36

Version

1.0.8

License

LGPL-3.0-only

Unpacked Size

1.46 MB

Total Files

28

Last publish

Collaborators

  • zs-ko