-
Notifications
You must be signed in to change notification settings - Fork 601
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
Update kncloudevents.Dispatcher
to add a JWT
#7328
Update kncloudevents.Dispatcher
to add a JWT
#7328
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #7328 +/- ##
==========================================
- Coverage 77.52% 76.88% -0.64%
==========================================
Files 250 252 +2
Lines 13573 13704 +131
==========================================
+ Hits 10522 10537 +15
- Misses 2525 2641 +116
Partials 526 526
☔ View full report in Codecov by Sentry. |
f52e92a
to
b432c31
Compare
kncloudevents.Dispatcher
to add a JWTkncloudevents.Dispatcher
to add a JWT
…include the token handler later
b432c31
to
edfef92
Compare
jwt, err := d.oidcTokenProvider.GetJWT(*oidcServiceAccount, *target.Audience) | ||
if err != nil { | ||
return nil, fmt.Errorf("could not get JWT: %w", err) | ||
} | ||
request.Header.Set("Authorization", fmt.Sprintf("Bearer: %s", jwt)) |
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.
@creydr sorry if this is a dumb question, I still don't 100% understand the full OIDC flow. In this code, why do we fail if we can't get a JWT, instead of just sending an event without an authorization header?
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 it as a contract between the caller and the dispatcher here. When the caller set an oidcServiceAccount (via the WithOIDCAuthentication(sa)
option), we assume that they want to use authentication. If we fail to request a token then, then we should report this back to the caller IMO.
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.
Does this help?
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.
Yeah that makes sense to me!
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 clarifying @creydr !!
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Cali0707, creydr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold |
/unhold |
Proposed Changes