Skip to content
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

Add support for multiple bearer tokens #38148

Merged
merged 16 commits into from
Mar 4, 2025

Conversation

bchen528
Copy link
Contributor

@bchen528 bchen528 commented Feb 24, 2025

Description

This PR introduces support for multiple bearer tokens in the bearer token auth extension.

Testing

  • Unit tests
  • Manually tested within custom otel collector to verify that multiple bearer tokens work

Documentation

  • Added changelog entry
  • Added configuration documentation for bearer token authentication extension

@bchen528 bchen528 requested review from jpkrohling and a team as code owners February 24, 2025 23:18
Copy link

linux-foundation-easycla bot commented Feb 24, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validate function should be changed to prevent users from setting both "token" and "tokens".

@jpkrohling
Copy link
Member

This can be merged when CI is green. Thanks!

@jpkrohling
Copy link
Member

This PR has been failing at the linting stage:

/home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib/.tools/golangci-lint run --allow-parallel-runners --build-tags integration --timeout=30m --path-prefix bearertokenauthextension
Error: bearertokenauthextension/bearertokenauth_test.go:339:9: G306: Expect WriteFile permissions to be 0600 or less (gosec)
	err := os.WriteFile(filename, []byte(fileContent), 0644)
	       ^

Please, run the linter locally and fix the issues it reports.

@bchen528
Copy link
Contributor Author

Thanks @jpkrohling! Done 👍

$ make lint
running /vagrant/opentelemetry-collector-contrib-becky/.tools/misspell -error
/vagrant/opentelemetry-collector-contrib-becky/.tools/golangci-lint run --allow-parallel-runners --build-tags integration --timeout=30m --path-prefix bearertokenauthextension
$ make test
cd /vagrant/opentelemetry-collector-contrib-becky/internal/tools && GOOS="" GOARCH="" go build -o /vagrant/opentelemetry-collector-contrib-becky/.tools/gotestsum -trimpath gotest.tools/gotestsum
go: downloading gotest.tools/gotestsum v1.12.0
go: downloading github.com/dnephin/pflag v1.0.7
go: downloading github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
go: downloading github.com/bitfield/gotestdox v0.2.2
/vagrant/opentelemetry-collector-contrib-becky/.tools/gotestsum --rerun-fails=1 --packages="./..." -- -race -timeout 600s -parallel 4 --tags=""
∅  internal/metadata
✓  . (26.095s)

DONE 26 tests in 73.562s

@atoulme atoulme added the ready to merge Code review completed; ready to merge by maintainers label Mar 4, 2025
@atoulme atoulme merged commit fca34bf into open-telemetry:main Mar 4, 2025
167 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension/bearertokenauth ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants