Skip to content

Commit c2f0f43

Browse files
committed
cli/command: remove deprecated functions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent fa9a0d3 commit c2f0f43

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

cli/command/registry.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -34,44 +34,6 @@ const (
3434
// [registry.IndexServer]: https://pkg.go.dev/github.com/docker/docker/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-
indexServer := index.Name
43-
configKey := getAuthConfigKey(indexServer)
44-
if index.Official {
45-
configKey = authConfigKey
46-
}
47-
promptMsg := fmt.Sprintf("Login prior to %s:", cmdName)
48-
return newPrivilegeFunc(cli, configKey, promptMsg)
49-
}
50-
51-
func newPrivilegeFunc(cli Cli, indexServer string, promptMsg string) registrytypes.RequestAuthConfig {
52-
return func(ctx context.Context) (string, error) {
53-
// TODO(thaJeztah): can we make the prompt an argument? ("prompt func()" or "prompt func()?
54-
_, _ = fmt.Fprint(cli.Out(), "\n"+promptMsg+"\n")
55-
isDefaultRegistry := indexServer == authConfigKey
56-
authConfig, err := GetDefaultAuthConfig(cli.ConfigFile(), true, indexServer, isDefaultRegistry)
57-
if err != nil {
58-
_, _ = fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", indexServer, err)
59-
}
60-
61-
select {
62-
case <-ctx.Done():
63-
return "", ctx.Err()
64-
default:
65-
}
66-
67-
authConfig, err = PromptUserForCredentials(ctx, cli, "", "", authConfig.Username, indexServer)
68-
if err != nil {
69-
return "", err
70-
}
71-
return registrytypes.EncodeAuthConfig(authConfig)
72-
}
73-
}
74-
7537
// ResolveAuthConfig returns auth-config for the given registry from the
7638
// credential-store. It returns an empty AuthConfig if no credentials were
7739
// found.
@@ -111,23 +73,6 @@ func GetDefaultAuthConfig(cfg *configfile.ConfigFile, checkCredStore bool, serve
11173
return registrytypes.AuthConfig(authconfig), nil
11274
}
11375

114-
// ConfigureAuth handles prompting of user's username and password if needed.
115-
//
116-
// Deprecated: use [PromptUserForCredentials] instead.
117-
func ConfigureAuth(ctx context.Context, cli Cli, flUser, flPassword string, authConfig *registrytypes.AuthConfig, _ bool) error {
118-
defaultUsername := authConfig.Username
119-
serverAddress := authConfig.ServerAddress
120-
121-
newAuthConfig, err := PromptUserForCredentials(ctx, cli, flUser, flPassword, defaultUsername, serverAddress)
122-
if err != nil {
123-
return err
124-
}
125-
126-
authConfig.Username = newAuthConfig.Username
127-
authConfig.Password = newAuthConfig.Password
128-
return nil
129-
}
130-
13176
// PromptUserForCredentials handles the CLI prompt for the user to input
13277
// credentials.
13378
// If argUser is not empty, then the user is only prompted for their password.

0 commit comments

Comments
 (0)