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.
@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.
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.
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold |
|
/unhold |
Proposed Changes