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

feat: add auth client and generate_disposable_token api #420

Merged
merged 8 commits into from
Jan 3, 2025

Conversation

anitarua
Copy link
Contributor

@anitarua anitarua commented Dec 19, 2024

Work towards #419

  • Implemented AuthClient and builder. No config object since there's no logging object to configure in this SDK like in the JS or Go ones.
  • Implemented permissions structure (PermissionScope and DisposableTokenScope and related objects)
  • Implemented generate_disposable_token method
  • Added docs and doctests for public-facing objects
  • Added integration tests to verify correctness of generate_disposable_token implementation
  • Updated test-util and on-pull-request workflow to accommodate new tests

After cutting a release, I can fast-follow with updating the docs snippets example file and unit tests for the permissions conversions.

@anitarua anitarua marked this pull request as ready for review December 20, 2024 02:05
@anitarua anitarua requested a review from a team December 20, 2024 02:05
@benbpyle
Copy link
Contributor

Thanks for implementing this feature!

tests/auth/disposable_tokens.rs Show resolved Hide resolved
tests/auth/disposable_tokens.rs Show resolved Hide resolved
tests/auth/disposable_tokens.rs Show resolved Hide resolved
tests/auth/disposable_tokens.rs Show resolved Hide resolved
@honeyAcorn
Copy link

I've verified the capability by using momento console to generate superuser api key.
Then use the Superuser API key to generate disposable token using rust sdk.
Those disposable token can only be used toward certain cache for only read or write or both.
Everything looks good except for some missing test case.

  1. prefix-write
  2. Can we add a verify for the expire time? Add one case to expire in a few seconds and test if it expires in integration test.

@anitarua anitarua requested a review from honeyAcorn January 2, 2025 19:37
Copy link

@honeyAcorn honeyAcorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@anitarua anitarua merged commit 432babf into main Jan 3, 2025
4 checks passed
@anitarua anitarua deleted the generate-disposable-token branch January 3, 2025 18:42
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.

4 participants