-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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: credential injector impl #30850
feat: credential injector impl #30850
Conversation
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
1350725
to
78d5e62
Compare
This comment was marked as outdated.
This comment was marked as outdated.
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.
Small API comment.
RE doc errors, I assume it is due to linking to "not-implemented-hide" protos.
api/envoy/extensions/filters/http/credential_injector/v3/credential_injector.proto
Outdated
Show resolved
Hide resolved
b829c04
to
b93e805
Compare
Assigning Kuat as code-owner. |
fff14f0
to
17e9c6a
Compare
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.
Thanks!
Left a small suggestion on the API, but otherwise the API LGTM.
api/envoy/extensions/filters/http/credential_injector/v3/credential_injector.proto
Show resolved
Hide resolved
887b67b
to
21934d7
Compare
Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
/retest |
After discussing with @wbpcode, we think the initialization process can be handled in individual credential extensions. This means the filter only needs to call the
@kyessenov I believe you suggested a similar approach before? If we're all in agreement with this approach, I'll proceed with updating the current implementation as outlined above. |
Sounds reasonable. The details are easier to work out once you have an implementation for oauth2. All we really need is to be able to pause a request, and let the extension handle the job itself (e.g. no explicit thread management in this filter). |
I'm thinking just failing the request and letting the client decide the next step(fail, retry, etc.) if the extension fails to initialize the credentials, like what we have done with the generic extension(SDS). By this way, we can decouple the filter and the extension's credential initialization/retry logic. |
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.
Thanks for your update. It's much simpler (and better) now. Fix the tests and CI, then it is ready for final review.
source/extensions/filters/http/credential_injector/credential_injector_filter.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
/retest |
no point retesting atm - test certs are currently broken (#33389) |
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.
Thanks for your update. It's near to there. Only some minor comments are added to the implementation details.
source/extensions/filters/http/credential_injector/credential_injector_filter.h
Outdated
Show resolved
Hide resolved
source/extensions/http/injected_credentials/generic/generic_impl.h
Outdated
Show resolved
Hide resolved
class MockSecretReader : public Http::InjectedCredentials::Common::SecretReader { | ||
public: | ||
MockSecretReader(const std::string& secret) : secret_(secret){}; | ||
const std::string& credential() const override { return secret_; } | ||
|
||
private: | ||
const std::string secret_; | ||
}; |
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.
nit: I think it would be better to mock the CredentialInjector
rather than to mock the SecretReader
. Because the filter actually only use the CredentialInjector
and the SecretReader
is only part of implementation of GenericCredentialInjector
.
/wait |
Signed-off-by: huabing zhao <zhaohuabing@gmail.com> wrap tests in anonymous namespace Signed-off-by: huabing zhao <zhaohuabing@gmail.com> address comments Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
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.
LGTM. Thanks so much for your great works and paying of so long time.
Thank you @kyessenov @lizan @adisuissa @wbpcode for helping on reviews and all the great feedback. I really appreciate it. |
* credential injector impl Signed-off-by: huabing zhao <zhaohuabing@gmail.com> --------- Signed-off-by: huabing zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com> Co-authored-by: phlax <phlax@users.noreply.github.com> Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Implementation for the credential injector HTTP filter.
This PR includes the implementation of the Credential Injector filter and the Generic extension type. The oauth2 extension type will be in a follow-up pR.
Related: #27769
Sponsor: @kyessenov kindly offered to be the sponsor of this new filter.
Risk Level: low
Testing: yes
Docs Changes: yes
Release Notes: yes
Platform Specific Features: No
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]