-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Labels
authIssues related to the auth libraryIssues related to the auth librarypriority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Milestone
Description
We have at couple of requests to fetch the access token. A few observations:
- The token should include the string value and the expiration time.
- The token should be wrapped in a
CacheableResource<>. - We should return an error for API keys.
- we need direct access to an access token to integrate with existing libraries like
object_store.object_storehas pretty rudimentary support for how it does gcloud auth, we were aiming to use your first party auth library to make it more complete/customized for our specific environments.@sai-sunder-s now that we have a clear need, we should restore the second method in
Credentialsto fetch the token. It would need to be something like:impl Credentials { async pub fn access_token(&self, ...) -> Result<CacheableResource<AccessToken>>;because it can fail to fetch the token (or the credential type may not support tokens at all) and you may want to cache a derived value and avoid recomputation. And
AccessTokenwould be something like:struct AccessToken { /* all private */} impl AccessToken { pub fn value(&self) -> String; pub fn type(&self) -> &'static str; // typically `Bearer` pub fn expiration_time(&self) -> std::time::Instant /* ??? SystemTime ??? */ }We also need to consider how to create tokens for mocking.
thorrester
Metadata
Metadata
Assignees
Labels
authIssues related to the auth libraryIssues related to the auth librarypriority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.