Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAT-14850]API Token authentication loops through the users and chec…
…ks token against each of these. Summary: API calls are taking longer than 30 seconds per request because we iterate through the list of Users to authenticate using the API token due to the block of ``` List<Users> usersList = find.query().where().isNotNull("apiToken").findList(); for (Users user : usersList) { if (Users.hasher.isValid(apiToken, user.getApiToken())) { return user; } } ``` This was introduced in https://phorge.dev.yugabyte.com/D35345 to store hash of the API Tokens in the YBA DB. The proposal to speed up the look up is to return `userUUID$apiToken` as the new API token that can be used to extract the user and verify the request token with the hashed token from the DB. The older look up is still supported, and clients wishing to increase performance can regenerate the API token to use the new workflow Test Plan: Tested with API calls, UI, CLI and Terraform for various auth methods that involve API tokens Works with both the older API tokens generated by the customer before this change and the new format of the API tokens Reviewers: #yba-api-review, sneelakantan, sanketh, nbhatia, amalyshev Reviewed By: #yba-api-review, sneelakantan, amalyshev Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D37083
- Loading branch information