A comprehensive TypeScript client library for interacting with Keycloak's Administration API.
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Attack detection provides brute force protection management, allowing administrators to monitor and clear attack detection data for users who have been temporarily disabled due to failed login attempts.
Manage brute force attack detection data and clear protection locks.
/**
* Get brute force attack detection data for a specific user
* @param params - Parameters containing the user ID
* @returns Attack detection data or undefined if not found
*/
findOne(params: { id: string }): Promise<Record<string, any> | undefined>;
/**
* Clear brute force attack detection data for a specific user
* @param params - Parameters containing the user ID
* @returns void
*/
del(params: { id: string }): Promise<void>;
/**
* Clear all brute force attack detection data for the realm
* @returns void
*/
delAll(): Promise<void>;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',
});
// Get attack detection data for a user
const attackData = await kcAdminClient.attackDetection.findOne({
id: 'user-id-here'
});
if (attackData) {
console.log('User has attack detection data:', attackData);
// Clear attack detection for this specific user
await kcAdminClient.attackDetection.del({
id: 'user-id-here'
});
console.log('Attack detection data cleared for user');
}
// Clear all attack detection data in the realm
await kcAdminClient.attackDetection.delAll();
console.log('All attack detection data cleared');Unlocking Users: When users are temporarily disabled due to brute force protection, administrators can use this API to clear the attack detection data and allow users to attempt login again.
Monitoring Security: Review attack detection data to identify patterns of failed login attempts and potential security threats.
Bulk Cleanup: Clear all attack detection data when needed, such as after resolving a system-wide authentication issue.
docs