Viewing user login activity
You can directly query the Keycloak application programming interface (API) to view your Package Security Manager (On-prem) user login activity.
Prerequisites
You must have Events enabled within Keycloak to track login events.
-
Verify you are on the dev realm.
-
Select Realm settings from the left-hand navigation, then open the Events tab.
-
Select the User events settings tab.
-
Verify the Save Events toggle is set to
ON
. -
Click Save.
Querying the Keycloak API
-
Open a terminal. Generate a temporary token and store it as an environment variable for the Keycloak API by running the following command:
You can verify that your command generated a token by running the command
echo $TKN
.This temporary token expires after 60 seconds, and the next command needs to be entered before the token expires! Don’t worry though, you can always generate another temporary token, if necessary.
-
Query the Keycloak API for
LOGIN
events by running the following command:
Example
Let’s say your Package Security Manager URL is https://data_science_snakes.anaconda.com, and your Keycloak administrator’s username is admin and their password is password.
Once you’ve verified that Keycloak is saving user login events, request a temporary token from the Keycloak API with the following command:
Before the token expires, run the following command to query the Keycloak API for Package Security Manager user login events:
If your query is processed correctly, your return will look something like this:
Was this page helpful?