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

Authentication limitation settings - v1.1.3

Compare
Choose a tag to compare
@Creaous Creaous released this 15 Mar 05:06
· 10 commits to main since this release

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