ARTIFACTORY: How to get the list of users generated API keys and Identity tokens for comparison purposes

ARTIFACTORY: How to get the list of users generated API keys and Identity tokens for comparison purposes

AuthorFullName__c
Muhammed Kashif
articleNumber
000005388
ft:sourceType
Salesforce
FirstPublishedDate
2022-08-29T09:49:12Z
lastModifiedDate
2022-08-29
VersionNumber
3

This article is written for the purpose of getting the list of users who generated API keys and Identity tokens for comparison purposes and work on migrating the users. This article intends the deprecation of the API keys and moves to Identity tokens.

The API Keys have started getting deprecated starting from 7.38 version as mentioned in the Artifactory release notes.

Below are the DB queries to get the list of usernames that generated the API keys and Identity tokens,

1. The list of usernames generated the API Keys
SELECT username FROM access_users WHERE user_id IN (SELECT user_id FROM access_users_custom_data WHERE prop_key='apiKey');

2. The list of usernames generated the Identity Token
Select username from access_tokens where hashed_reference is not NULL;

The Access tokens and Identity tokens (also referred as Reference tokens) are stored in the access_tokens table in the DB when generated. When an Access token is created it is stored in access_tokens tables and NULL in the hashed_reference column and when an Identity token is created, it is stored in the access_tokens table and some hashed info in the hashed_reference column.