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

Refresh authn.DefaultKeychain creds every 5 min #1624

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

jonjohnsonjr
Copy link
Collaborator

Sometimes Authenticators stick around for a while and eventually expire. This changes modifies Authenticators returned by DefaultKeychain to re-resolve after 5 minutes to ensure the underlying creds are fresh.

The hard-coded 5 minutes should prevent us from spamming the underlying Keychain (it can be expensive) while also preventing the creds from expiring.

Copy link
Collaborator

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

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

Love it.

pkg/authn/keychain.go Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #1624 (e01b487) into main (b8d1c0a) will increase coverage by 0.06%.
The diff coverage is 90.62%.

@@            Coverage Diff             @@
##             main    #1624      +/-   ##
==========================================
+ Coverage   72.75%   72.81%   +0.06%     
==========================================
  Files         118      118              
  Lines        9466     9498      +32     
==========================================
+ Hits         6887     6916      +29     
- Misses       1880     1882       +2     
- Partials      699      700       +1     
Impacted Files Coverage Δ
pkg/authn/keychain.go 94.23% <90.62%> (-1.61%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Sometimes Authenticators stick around for a while and eventually expire.
This changes modifies Authenticators returned by DefaultKeychain to
re-resolve after 5 minutes to ensure the underlying creds are fresh.

The hard-coded 5 minutes should prevent us from spamming the underlying
Keychain (it can be expensive) while also preventing the creds from
expiring.

This also exposes authn.RefreshingKeychain for others to use.
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.

None yet

3 participants