Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add CredentialProvider & support v1 tokens (#146)
Add the `CredentialProvider` construct that we have in other SDKs to parse auth tokens and get cache and control endpoints. This replaces the `EndpointResolver` and `jwt` modules. Credential Providers can either be created from a string or an environment variable. They can optionally override the cache and control endpoints (or just one or the other). ```rust let credential_provider = CredentialProviderBuilder::new_from_environment_variable("TEST_AUTH_TOKEN") .build() .expect("TEST_AUTH_TOKEN must be set"); ``` ```rust let credential_provider = CredentialProviderBuilder::new_from_string("my_test_token") .with_cache_endpoint("cache.localhost") .with_control_endpoint("control.localhost") .build() .expect("could not parse token and endpoints") ``` then ```rust let mut momento = SimpleCacheClientBuilder::new(credential_provider, Duration::from_secs(30))?.build(); ``` Co-authored-by: Kenny <[email protected]>
- Loading branch information