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

Authentication limitation settings (reupload) - v1.1.4

Compare
Choose a tag to compare
@Creaous Creaous released this 15 Mar 09:18
· 8 commits to main since this release

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