This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
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