@ironstring44/ally-keycloak
v0.0.3
Published
Keycloak OpenID Connect driver for AdonisJS Ally
Maintainers
Readme
AdonisJS Ally Keycloak driver
An OpenID Connect driver for authenticating AdonisJS applications with Keycloak.
This package implements the standard Keycloak authorization-code flow for AdonisJS Ally.
Configuration
The Keycloak URLs are configurable so the driver works with any Keycloak host and realm:
import { KeycloakDriverService } from '@ironstring44/ally-keycloak'
const realmUrl = env.get('KEYCLOAK_URL') + '/realms/' + env.get('KEYCLOAK_REALM')
defineConfig({
keycloak: KeycloakDriverService({
clientId: env.get('KEYCLOAK_CLIENT_ID')!,
clientSecret: env.get('KEYCLOAK_CLIENT_SECRET')!,
callbackUrl: env.get('KEYCLOAK_CALLBACK_URL')!,
authorizeUrl: realmUrl + '/protocol/openid-connect/auth',
accessTokenUrl: realmUrl + '/protocol/openid-connect/token',
userInfoUrl: realmUrl + '/protocol/openid-connect/userinfo',
}),
})The default scopes are openid, profile, and email. Override them with the scopes option when needed.
User data
The driver reads the standard Keycloak UserInfo claims: sub, preferred_username, name, given_name, family_name, email, email_verified, and picture. The complete response is preserved in user.original.
Development
npm testRuns the TypeScript build and HTTP-level driver tests.
npm run lintChecks the source and tests with ESLint.
Release
The package is published to npm by GitHub Actions when a semver tag is pushed.
The tag must match the version in package.json and the repository must have
an NPM_TOKEN Actions secret.
npm version patch
git push origin main --follow-tags