Provide endpoint for token usage overview page #21315
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #21396
To allow an overview of all existing access-tokens and their owners, there's a new searchable, paginated endpoint providing all necessary data.
Description
The endpoint returns the following fields per existing token:
Motivation and Context
An admin can create auth tokens for token access for a user. If this user is a user from OIDC/LDAP (e.g. keycloak) and that user is disabled later in the auth server, the auth tokens still remain valid, because the user still has the "enabled" flag in the Graylog Database. There is no sync process which will subsequently remove the enabled flag on the record, regardless of the status of the external account. As a result, an API token belonging to a disabled or deleted user can potentially be used to perform actions.
This PR provides all required information for an overview-page across al users and tokens, so the admin doesn't need to check all tokens user by user manually, but gets all of them in one place.
How Has This Been Tested?
There are some unit-tests for the newly created classes, but the functionality was also tested locally using curl.
Types of changes
Checklist: