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:
@@ -2,9 +2,10 @@ package wincred
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"strings"
|
||||||
|
|
||||||
winc "github.com/danieljoos/wincred"
|
winc "github.com/danieljoos/wincred"
|
||||||
"github.com/docker/docker-credential-helpers/credentials"
|
"github.com/docker/docker-credential-helpers/credentials"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Wincred handles secrets using the Windows credential service.
|
// Wincred handles secrets using the Windows credential service.
|
||||||
@@ -39,7 +40,14 @@ func (h Wincred) Get(serverURL string) (string, string, error) {
|
|||||||
if g == nil {
|
if g == nil {
|
||||||
return "", "", credentials.NewErrCredentialsNotFound()
|
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.
|
// List returns the stored URLs and corresponding usernames for a given credentials label.
|
||||||
|
|||||||
Reference in New Issue
Block a user