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

[extension/bearertokenauthextension] support reading tokens from file #14326

Conversation

frzifus
Copy link
Member

@frzifus frzifus commented Sep 20, 2022

Description:
This pr extends the bearer token extension by the possibility to read tokens from a file. If a token file has been specified, this file is read once when the extension is started and overwrites the old token. Only if the content of the token changes again, the transferred token will be overwritten again.

Link to tracking Issue: #14325

Testing:

  • starting the extension while its already running
  • stopping the extension
  • make sure the token is updated when the file content changed

Documentation:
Updated extension Readme

@frzifus frzifus force-pushed the bearertokenauthextension_support_token_from_file branch from 89ea2bb to 5081cfc Compare September 20, 2022 11:35
@frzifus frzifus marked this pull request as ready for review September 20, 2022 11:35
@frzifus frzifus requested a review from a team September 20, 2022 11:35
This commit extends the bearer token extension by the possibility to
read tokens from a file.

Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
@frzifus frzifus force-pushed the bearertokenauthextension_support_token_from_file branch from 5081cfc to 8545df2 Compare September 20, 2022 12:13
extension/bearertokenauthextension/README.md Outdated Show resolved Hide resolved
}

if b.shutdownCH != nil {
return fmt.Errorf("bearerToken file monitoring is already running")
Copy link
Member

Choose a reason for hiding this comment

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

When would this be the case?

Copy link
Member Author

Choose a reason for hiding this comment

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

The shutdown channel is created when the extension is started and removed when stop is called. This channel condition is used to prevent another watcher from being spawned.

Copy link
Member

Choose a reason for hiding this comment

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

Is this happening when the component is started twice without being shut down?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hopefully never. But yes, in case it get started twice, before it was stopped.

extension/bearertokenauthextension/bearertokenauth.go Outdated Show resolved Hide resolved
extension/bearertokenauthextension/bearertokenauth.go Outdated Show resolved Hide resolved
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
…ogger

Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>
@frzifus frzifus force-pushed the bearertokenauthextension_support_token_from_file branch from d30f1c5 to 7b7f712 Compare September 29, 2022 11:00
@jpkrohling jpkrohling merged commit bcdc704 into open-telemetry:main Sep 29, 2022
@frzifus frzifus deleted the bearertokenauthextension_support_token_from_file branch September 29, 2022 14:07
@plantfansam plantfansam mentioned this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants