Identity and Access Management (IAM) platforms control user authentication and access to protected applications. Keycloak is an open-source IAM platform that provides user authentication, identity federation, single sign-on, and access-management capabilities. It records authentication-related events that can be used to examine login activity and investigate suspicious account-access behavior.
Account-takeover attacks occur when an unauthorized person gains access to a legitimate user's account. Such activity may involve the use of compromised credentials, authentication from unfamiliar clients, unusual login sequences, or changes in previously observed login behavior. A login attempt using valid credentials may still be suspicious if its surrounding behavioral characteristics differ from the account's normal activity.
Conventional authentication mechanisms primarily verify credentials and apply configured authentication policies. Although these controls are essential, credential verification alone does not establish whether a login attempt originates from the legitimate account owner. Sequential authentication analysis provides an additional approach for identifying suspicious patterns across multiple login events.
In this use case, Keycloak is deployed in an isolated Ubuntu and Kali Linux laboratory environment. Keycloak manages designated test accounts and generates authentication events during normal operations and controlled security testing.
An existing public authentication-event dataset is used as the data source for machine-learning training and evaluation. The dataset is inspected to identify available authentication attributes and account-takeover labels. Suitable records are processed to construct sequential login features for the Transformer model.
A Transformer-based classification model is trained using the selected labelled authentication sequences. The model learns relationships between events in a sequence and generates predictions for authentication behavior that may be associated with account-takeover activity.
A controlled account-takeover scenario is then reproduced against the laboratory Keycloak environment. Authentication events are collected from the controlled scenario and processed through a compatible feature-extraction pipeline. The trained Transformer model evaluates the resulting login sequence and generates a classification prediction.
The model prediction is compared with the known laboratory test condition to evaluate the detection workflow. The Transformer model operates as a separate Python-based detection component; it is not presented as a built-in Keycloak feature.
The complete workflow is:
Public Authentication-Event Dataset
→
Data Inspection
→
Label Identification
→
Data Preprocessing
→
Sequential Login Feature Extraction
→
Transformer Model Training
→
Model Evaluation
→
Keycloak IAM Deployment
→
Controlled Account-Takeover Simulation
→
Authentication Event Collection
→
Sequential Feature Extraction
→
Transformer Analysis
→
Suspicious Login Detection
→
Account-Takeover Validation