From 03da6ad2d15e439ecf36e68900022069f2b74df4 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 22 Jul 2025 22:42:59 +0200 Subject: [PATCH] cli/command: remove deprecated RegistryAuthenticationPrivilegedFunc This function was deprecated in 29263e865b2d309753759b26fcbe16d94a8f25e3 and is no longer used. Signed-off-by: Sebastiaan van Stijn --- cli/command/registry.go | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/cli/command/registry.go b/cli/command/registry.go index 036c53b1b2ca..2a727e32b103 100644 --- a/cli/command/registry.go +++ b/cli/command/registry.go @@ -34,34 +34,6 @@ const ( // [registry.IndexServer]: https://pkg.go.dev/github.com/docker/docker@v28.3.3+incompatible/registry#IndexServer const authConfigKey = "https://index.docker.io/v1/" -// RegistryAuthenticationPrivilegedFunc returns a RequestPrivilegeFunc from the specified registry index info -// for the given command to prompt the user for username and password. -// -// Deprecated: this function is no longer used and will be removed in the next release. -func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) registrytypes.RequestAuthConfig { - configKey := getAuthConfigKey(index.Name) - isDefaultRegistry := configKey == authConfigKey || index.Official - return func(ctx context.Context) (string, error) { - _, _ = fmt.Fprintf(cli.Out(), "\nLogin prior to %s:\n", cmdName) - authConfig, err := GetDefaultAuthConfig(cli.ConfigFile(), true, configKey, isDefaultRegistry) - if err != nil { - _, _ = fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", configKey, err) - } - - select { - case <-ctx.Done(): - return "", ctx.Err() - default: - } - - authConfig, err = PromptUserForCredentials(ctx, cli, "", "", authConfig.Username, configKey) - if err != nil { - return "", err - } - return registrytypes.EncodeAuthConfig(authConfig) - } -} - // ResolveAuthConfig returns auth-config for the given registry from the // credential-store. It returns an empty AuthConfig if no credentials were // found.