Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide endpoint for token usage overview page #21315

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

fpetersen-gl
Copy link
Contributor

@fpetersen-gl fpetersen-gl commented Jan 10, 2025

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:

  • ID of the token
  • User-name
  • ID of the owning user
  • Name of the token
  • Timestamp of the creation of the token
  • Timestamp of last access of the token
  • If the user is external or not
  • For external users, the name of the authentication-back-end.

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@fpetersen-gl fpetersen-gl marked this pull request as ready for review January 21, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend for "Token Usage" page
1 participant