CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-keycloak--keycloak-admin-client

A comprehensive TypeScript client library for interacting with Keycloak's Administration API.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

cache-management.mddocs/

Cache Management

Cache management provides operations to clear various Keycloak caches, helping administrators refresh cached data and resolve caching-related issues in production environments.

Capabilities

Cache Clearing Operations

Clear specific types of caches to refresh system state.

/**
 * Clear the user cache for the realm
 * @returns void
 */
clearUserCache(): Promise<void>;

/**
 * Clear the keys cache for the realm
 * @returns void
 */
clearKeysCache(): Promise<void>;

/**
 * Clear the CRL (Certificate Revocation List) cache for the realm
 * @returns void
 */
clearCrlCache(): Promise<void>;

/**
 * Clear the realm cache
 * @returns void
 */
clearRealmCache(): Promise<void>;

Usage Examples

import KeycloakAdminClient from "@keycloak/keycloak-admin-client";

const kcAdminClient = new KeycloakAdminClient({
  baseUrl: 'http://localhost:8080',
  realmName: 'myrealm',
});

await kcAdminClient.auth({
  username: 'admin',
  password: 'admin',
  grantType: 'password',
  clientId: 'admin-cli',
});

// Clear user cache (useful after user updates)
await kcAdminClient.cache.clearUserCache();
console.log('User cache cleared');

// Clear keys cache (useful after key rotation)
await kcAdminClient.cache.clearKeysCache();
console.log('Keys cache cleared');

// Clear CRL cache (useful after certificate updates)
await kcAdminClient.cache.clearCrlCache();
console.log('CRL cache cleared');

// Clear realm cache (useful after realm configuration changes)
await kcAdminClient.cache.clearRealmCache();
console.log('Realm cache cleared');

// Clear all caches sequentially
async function clearAllCaches() {
  await kcAdminClient.cache.clearUserCache();
  await kcAdminClient.cache.clearKeysCache();
  await kcAdminClient.cache.clearCrlCache();
  await kcAdminClient.cache.clearRealmCache();
  console.log('All caches cleared');
}

await clearAllCaches();

Common Use Cases

After Configuration Changes: Clear relevant caches after modifying realm settings, user attributes, or security configurations to ensure changes take effect immediately.

Performance Troubleshooting: Clear caches to resolve performance issues or stale data problems in production environments.

Key Rotation: Clear the keys cache after rotating signing keys or certificates to ensure new keys are immediately available.

User Management: Clear user cache after bulk user operations or identity provider synchronization to refresh user data.

docs

attack-detection.md

authentication-management.md

cache-management.md

client-configuration.md

client-management.md

client-policies.md

client-scopes.md

components.md

group-management.md

identity-providers.md

index.md

organization-management.md

realm-management.md

role-management.md

server-info.md

user-management.md

user-storage-provider.md

utility-functions.md

whoami.md

tile.json