@x12i/xentra-identity-keycloak
v0.2.0
Published
Keycloak identity adapter for Xentra
Readme
@x12i/xentra-identity-keycloak
Keycloak implementation of the Xentra identity provider adapter.
Install
npm install @x12i/xentra-identity-keycloakDepends on @x12i/xentra-identity.
Usage
import { createKeycloakAdapter, type KeycloakConfig } from "@x12i/xentra-identity-keycloak";
const config: KeycloakConfig = {
baseUrl: "https://auth.example.com",
realm: "xentra",
clientId: "xentra-service",
clientSecret: process.env.KEYCLOAK_CLIENT_SECRET,
};
const adapter = createKeycloakAdapter(config);
const orgRef = await adapter.createOrganization({ name: "Acme", slug: "acme" });
const userRef = await adapter.createUser({ email: "[email protected]", displayName: "User" });
const identity = await adapter.verifyExternalToken({ token: accessToken });Custom Keycloak client
Pass a KeycloakClient implementation as the second argument to createKeycloakAdapter for real Admin API calls. Without a client, the adapter uses deterministic stub external ids and JWT payload decoding for verifyExternalToken.
Configuration
| Field | Description |
|-------|-------------|
| baseUrl | Keycloak server URL |
| realm | Realm name |
| clientId | Service account or app client id |
| clientSecret | Optional client secret |
| adminToken | Optional pre-issued admin token |
Related packages
@x12i/xentra-identity— adapter interface and input types@x12i/xentra-api— depends on this package for future IdP sync routes
Development
npm run build -w @x12i/xentra-identity-keycloak
npm test -w @x12i/xentra-identity-keycloakLicense
MIT
