Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Releases: Nexirift/plugin-keycloak

Deprecated - v1.1.6

09 Apr 09:39
Compare
Choose a tag to compare

⚠️ 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

26 Mar 23:50
Compare
Choose a tag to compare

⚠️ This update has BREAKING CHANGES, please read below. ⚠️

Breaking Changes

  • Removed dependency on keycloak-backend
  • Changed ITokenContent to KeycloakToken

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

15 Mar 09:18
Compare
Choose a tag to compare

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

15 Mar 05:06
Compare
Choose a tag to compare

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

05 Mar 22:48
Compare
Choose a tag to compare

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

05 Mar 10:51
Compare
Choose a tag to compare

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

03 Mar 12:18
Compare
Choose a tag to compare

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