-
Notifications
You must be signed in to change notification settings - Fork 94
feat(auth): allow customers to provide a SubjectTokenProvider impl #2383
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
Closed
alvarowolfx
wants to merge
5
commits into
googleapis:main
from
alvarowolfx:feat-auth-programmatic-source
Closed
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
56be8e6
feat(auth): allow customers to provide a SubjectTokenProvider impl
alvarowolfx 094c769
fix: lint issues
alvarowolfx 11573ee
fix: remove async_trait from public SubjectTokenProvider trait
alvarowolfx d15957d
Merge branch 'main' into feat-auth-programmatic-source
alvarowolfx 4ee6c3a
fix: panic when missing token provider
alvarowolfx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the advantage of using a trait with a single function vs. a thing that implements the
AsyncFntrait?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL
AsyncFn. Gonna check it out how to use that. But to your point, I was just trying to follow the same pattern from the repo with things likeCredentialsProvider, but this one in particular has two methods, so makes sense to be a trait.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AsyncFn is a Rust 2024 feature.... I feat it might not work if the caller is using Rust Edition 2021, so make sure it does, otherwise the trait is a better idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trying to use
AsyncFnand as it's optional on theexternal_account::Builder, I'm not finding a way to use withoutdynandAsyncFnis notdyncompatible. Any tips ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Says here that asyncfn is nightly-only experimental API https://doc.rust-lang.org/std/ops/trait.AsyncFn.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not quite right.
AsyncFnis stable:rust-lang/rust#132706
Manually implementing the
AsyncFntrait is not stable. That is, you cannot sayimpl AsyncFn for MyType ...because the types and methods of the trait are unstable. But you can assume thatAsyncFnwill be around, and that you can call such functions.As to the
dyn-compatibleproblems: you could solve that with a private trait:But overall it seems that
AsyncFnis more trouble than it is worth.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thank you for the context!.