It was only used by the CLI, which now has its own fork.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -9,6 +9,5 @@ import ( |
| 9 | 9 |
|
| 10 | 10 |
// AuthenticateToRegistry checks the validity of credentials in authConfig |
| 11 | 11 |
func (daemon *Daemon) AuthenticateToRegistry(ctx context.Context, authConfig *registry.AuthConfig) (string, error) {
|
| 12 |
- _, token, err := daemon.registryService.Auth(ctx, authConfig, dockerversion.DockerUserAgent(ctx)) |
|
| 13 |
- return token, err |
|
| 12 |
+ return daemon.registryService.Auth(ctx, authConfig, dockerversion.DockerUserAgent(ctx)) |
|
| 14 | 13 |
} |
| ... | ... |
@@ -56,7 +56,7 @@ func (s *Service) ReplaceConfig(options ServiceOptions) (commit func(), _ error) |
| 56 | 56 |
// Auth contacts the public registry with the provided credentials, |
| 57 | 57 |
// and returns OK if authentication was successful. |
| 58 | 58 |
// It can be used to verify the validity of a client's credentials. |
| 59 |
-func (s *Service) Auth(ctx context.Context, authConfig *registry.AuthConfig, userAgent string) (statusMessage, token string, _ error) {
|
|
| 59 |
+func (s *Service) Auth(ctx context.Context, authConfig *registry.AuthConfig, userAgent string) (token string, _ error) {
|
|
| 60 | 60 |
// TODO Use ctx when searching for repositories |
| 61 | 61 |
registryHostName := IndexHostname |
| 62 | 62 |
|
| ... | ... |
@@ -67,7 +67,7 @@ func (s *Service) Auth(ctx context.Context, authConfig *registry.AuthConfig, use |
| 67 | 67 |
} |
| 68 | 68 |
u, err := url.Parse(serverAddress) |
| 69 | 69 |
if err != nil {
|
| 70 |
- return "", "", invalidParamWrapf(err, "unable to parse server address") |
|
| 70 |
+ return "", invalidParamWrapf(err, "unable to parse server address") |
|
| 71 | 71 |
} |
| 72 | 72 |
registryHostName = u.Host |
| 73 | 73 |
} |
| ... | ... |
@@ -79,9 +79,9 @@ func (s *Service) Auth(ctx context.Context, authConfig *registry.AuthConfig, use |
| 79 | 79 |
s.mu.RUnlock() |
| 80 | 80 |
if err != nil {
|
| 81 | 81 |
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
|
| 82 |
- return "", "", err |
|
| 82 |
+ return "", err |
|
| 83 | 83 |
} |
| 84 |
- return "", "", invalidParam(err) |
|
| 84 |
+ return "", invalidParam(err) |
|
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 | 87 |
var lastErr error |
| ... | ... |
@@ -90,7 +90,7 @@ func (s *Service) Auth(ctx context.Context, authConfig *registry.AuthConfig, use |
| 90 | 90 |
if err != nil {
|
| 91 | 91 |
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) || cerrdefs.IsUnauthorized(err) {
|
| 92 | 92 |
// Failed to authenticate; don't continue with (non-TLS) endpoints. |
| 93 |
- return "", "", err |
|
| 93 |
+ return "", err |
|
| 94 | 94 |
} |
| 95 | 95 |
// Try next endpoint |
| 96 | 96 |
log.G(ctx).WithFields(log.Fields{
|
| ... | ... |
@@ -101,11 +101,10 @@ func (s *Service) Auth(ctx context.Context, authConfig *registry.AuthConfig, use |
| 101 | 101 |
continue |
| 102 | 102 |
} |
| 103 | 103 |
|
| 104 |
- // TODO(thaJeztah): move the statusMessage to the API endpoint; we don't need to produce that here? |
|
| 105 |
- return "Login Succeeded", authToken, nil |
|
| 104 |
+ return authToken, nil |
|
| 106 | 105 |
} |
| 107 | 106 |
|
| 108 |
- return "", "", lastErr |
|
| 107 |
+ return "", lastErr |
|
| 109 | 108 |
} |
| 110 | 109 |
|
| 111 | 110 |
// ResolveAuthConfig looks up authentication for the given reference from the |