Skip to content

Commit 7a94b80

Browse files
authored
Merge pull request moby#5859 from MichaelKorn/shorter-auth-default-expire
fix: reduce default expire time for opaque tokens
2 parents d42d8a3 + 8dbfa43 commit 7a94b80

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

session/auth/authprovider/authprovider.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type DockerAuthProviderConfig struct {
4545
TLSConfigs map[string]*AuthTLSConfig
4646
// ExpireCachedAuth is a function that returns true auth config should be refreshed
4747
// instead of using a pre-cached result.
48-
// If nil then the cached result will expire after 10 minutes.
48+
// If nil then the cached result will expire after 4 minutes and 50 seconds.
4949
// The function is called with the time the cached auth config was created
5050
// and the server URL the auth config is for.
5151
ExpireCachedAuth func(created time.Time, serverURL string) bool
@@ -59,7 +59,8 @@ type authConfigCacheEntry struct {
5959
func NewDockerAuthProvider(cfg DockerAuthProviderConfig) session.Attachable {
6060
if cfg.ExpireCachedAuth == nil {
6161
cfg.ExpireCachedAuth = func(created time.Time, _ string) bool {
62-
return time.Since(created) > 10*time.Minute
62+
// Tokens for Google Artifact Registry via Workload Identity expire after 5 minutes.
63+
return time.Since(created) > 4*time.Minute+50*time.Second
6364
}
6465
}
6566
return &authProvider{

0 commit comments

Comments
 (0)