Skip to content

Commit 27734fd

Browse files
authored
Merge pull request #6349 from thaJeztah/rm_RegistryAuthenticationPrivilegedFunc
cli/command: remove deprecated RegistryAuthenticationPrivilegedFunc
2 parents abe4aa7 + 03da6ad commit 27734fd

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

cli/command/registry.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,6 @@ const (
3434
// [registry.IndexServer]: https://pkg.go.dev/github.com/docker/[email protected]+incompatible/registry#IndexServer
3535
const authConfigKey = "https://index.docker.io/v1/"
3636

37-
// RegistryAuthenticationPrivilegedFunc returns a RequestPrivilegeFunc from the specified registry index info
38-
// for the given command to prompt the user for username and password.
39-
//
40-
// Deprecated: this function is no longer used and will be removed in the next release.
41-
func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) registrytypes.RequestAuthConfig {
42-
configKey := getAuthConfigKey(index.Name)
43-
isDefaultRegistry := configKey == authConfigKey || index.Official
44-
return func(ctx context.Context) (string, error) {
45-
_, _ = fmt.Fprintf(cli.Out(), "\nLogin prior to %s:\n", cmdName)
46-
authConfig, err := GetDefaultAuthConfig(cli.ConfigFile(), true, configKey, isDefaultRegistry)
47-
if err != nil {
48-
_, _ = fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", configKey, err)
49-
}
50-
51-
select {
52-
case <-ctx.Done():
53-
return "", ctx.Err()
54-
default:
55-
}
56-
57-
authConfig, err = PromptUserForCredentials(ctx, cli, "", "", authConfig.Username, configKey)
58-
if err != nil {
59-
return "", err
60-
}
61-
return registrytypes.EncodeAuthConfig(authConfig)
62-
}
63-
}
64-
6537
// ResolveAuthConfig returns auth-config for the given registry from the
6638
// credential-store. It returns an empty AuthConfig if no credentials were
6739
// found.

0 commit comments

Comments
 (0)