Skip to content

Authenticate Requests from ApiServerSources #7321

@creydr

Description

@creydr

As the Eventing OIDC feature track describes, sources must authenticate their requests. Therefor the ApiServerSource must request a JWT and add it as a Bearer Token to its Authentication header.

When having #7175, we need to update the ApiServerSource to add the Authentication header with a JWT to all outgoing requests.

In particular this means for the ApiServerSource:

  • when the sink has no audience defined:
    • no change in behavior
  • when the the sink has an audience defined:
    • Request a JWT via Provide a library for OIDC token management #7175
    • Add it as an http header to the cloudeventsSDK client via something like
      headers := http.HeaderFrom(ctx)
      headers.Set("Authentication", fmt.Sprintf("Bearer %s", jwt))
      ctx = http.WithCustomHeader(ctx, headers)
      
      client.Send(ctx, event)
      

Additional Information:

Metadata

Metadata

Assignees

Labels

help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions