Releases: Nexirift/plugin-keycloak
Deprecated - v1.1.6
⚠️ plugin-keycloak has been deprecated in favour of plugin-oidc, please read below. ⚠️
Deprecation Notice
As of the 9th of April 2024, plugin-keycloak has been deprecated, effective immediately. If you wish to use this package, please switch to plugin-oidc as that will be our new maintained version. The new plugin will have support for OpenID Connect compatible clients meaning that you can use other services like Authentik.
Install
- Using yarn:
yarn add @nexirift/plugin-keycloak
- Using npm:
npm i @nexirift/plugin-keycloak
- Using bun:
bun install @nexirift/plugin-keycloak
Full Changelog: 1.1.5...1.1.6
Scope checking - v1.1.5
⚠️ This update has BREAKING CHANGES, please read below. ⚠️
Breaking Changes
- Removed dependency on
keycloak-backend
- Changed
ITokenContent
toKeycloakToken
How to migrate
See this commit for changes required (excluding the new checkScopes
query and migration to bun).
Scope checking
To check scopes, first ensure that the ctx.keycloak is of type KeycloakToken
.
Example
(new KeycloakToken(ctx.keycloak).hasScopes(["openid"])
Install
- Using yarn:
yarn add @nexirift/plugin-keycloak
- Using npm:
npm i @nexirift/plugin-keycloak
- Using bun:
bun install @nexirift/plugin-keycloak
Full Changelog: 1.1.4...1.1.5
Authentication limitation settings (reupload) - v1.1.4
this is a reupload of v1.1.3 - fixed allowed roles always being blank
Notable Changes
- Added
allowedRoles
field to restrict access to only allow certain roles. - Added
requireAuth
field to restrict access to allow authenticated users only. - Added
messages
field for customisable messages:- invalidToken: 'The provided access token is invalid.',
- expiredToken: 'An invalid or expired access token was provided.',
- invalidPermissions: 'You do not have the necessary permissions to access this resource.',
- authRequired: 'Authentication is required to access this resource.'
Example with the new changes
const yoga = createYoga({
schema: schema,
plugins: [
useKeycloak({
keycloak: keycloak,
redis: tokenClient,
allowedRoles: ['galaxy-access'],
requireAuth: true,
messages: {
invalidToken: 'The provided access token is invalid.',
expiredToken:
'An invalid or expired access token was provided.',
invalidPermissions:
'You do not have the necessary permissions to access this resource.',
authRequired:
'Authentication is required to access this resource.'
}
})
]
});
Install
- Using yarn:
yarn add @nexirift/plugin-keycloak
- Using npm:
npm i @nexirift/plugin-keycloak
Full Changelog: 1.1.2...1.1.4
Authentication limitation settings - v1.1.3
Notable Changes
- Added
allowedRoles
field to restrict access to only allow certain roles. - Added
requireAuth
field to restrict access to allow authenticated users only. - Added
messages
field for customisable messages:- invalidToken: 'The provided access token is invalid.',
- expiredToken: 'An invalid or expired access token was provided.',
- invalidPermissions: 'You do not have the necessary permissions to access this resource.',
- authRequired: 'Authentication is required to access this resource.'
Example with the new changes
const yoga = createYoga({
schema: schema,
plugins: [
useKeycloak({
keycloak: keycloak,
redis: tokenClient,
allowedRoles: ['galaxy-access'],
requireAuth: true,
messages: {
invalidToken: 'The provided access token is invalid.',
expiredToken:
'An invalid or expired access token was provided.',
invalidPermissions:
'You do not have the necessary permissions to access this resource.',
authRequired:
'Authentication is required to access this resource.'
}
})
]
});
Install
- Using yarn:
yarn add @nexirift/plugin-keycloak
- Using npm:
npm i @nexirift/plugin-keycloak
Full Changelog: 1.1.2...v1.1.3
Fix expiry - v1.1.2
Notable Changes
- Fixed a major flaw in the Redis expiration system.
- Token expiry will now be set to the same expiry as Keycloak tokens
We now have an example repository!
You can visit the example repository here: https://github.com/Nexirift/plugin-keycloak-example
Full Changelog: 1.1.1...v1.1.2
Options, options and more options! - v1.1.1
Notable Changes
- Improved documentation.
- Added options:
- Cache prefix: useful for listening to set events.
- Expiration: set expiration of Redis tokens.
Source Changes
- Add extra comments to explain stuff.
- Added .prettierrc for development.
- Formatted index.ts using Prettier.
We now have an example repository!
You can visit the example repository here: https://github.com/Nexirift/plugin-keycloak-example
Full Changelog: 1.1.0...1.1.1
1.1.0
First public release!
Install with your favourite package manager:
- NPM:
npm i @nexirift/plugin-keycloak
- Yarn:
yarn add @nexirift/plugin-keycloak
Full Changelog: https://github.com/Nexirift/plugin-keycloak/commits/1.1.0