1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

Merge pull request #56 from simonferquel/align-get-with-list-filtering

[Windows] align get with list behavior
This commit is contained in:
Vincent Demeester
2017-03-22 09:53:49 +01:00
committed by GitHub
+10 -2
View File
@@ -2,9 +2,10 @@ package wincred
import (
"bytes"
"strings"
winc "github.com/danieljoos/wincred"
"github.com/docker/docker-credential-helpers/credentials"
"strings"
)
// Wincred handles secrets using the Windows credential service.
@@ -39,7 +40,14 @@ func (h Wincred) Get(serverURL string) (string, string, error) {
if g == nil {
return "", "", credentials.NewErrCredentialsNotFound()
}
return g.UserName, string(g.CredentialBlob), nil
for _, attr := range g.Attributes {
if strings.Compare(attr.Keyword, "label") == 0 &&
bytes.Compare(attr.Value, []byte(credentials.CredsLabel)) == 0 {
return g.UserName, string(g.CredentialBlob), nil
}
}
return "", "", credentials.NewErrCredentialsNotFound()
}
// List returns the stored URLs and corresponding usernames for a given credentials label.