Skip to content

Commit f9d3010

Browse files
authored
Merge pull request #367 from akerouanton/osxkeychain-set-atyp
osxkeychain: store: add atyp attribute
2 parents cfd6d21 + e7bd395 commit f9d3010

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

osxkeychain/osxkeychain.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ func (h Osxkeychain) Add(creds *credentials.Credentials) error {
4646
item.SetLabel(credentials.CredsLabel)
4747
item.SetAccount(creds.Username)
4848
item.SetData([]byte(creds.Secret))
49+
// Prior to v0.9, the credential helper was searching for credentials with
50+
// the "dflt" authentication type (see [1]). Since v0.9.0, Get doesn't use
51+
// that attribute anymore, and v0.9.0 - v0.9.2 were not setting it here
52+
// either.
53+
//
54+
// In order to keep compatibility with older versions, we need to store
55+
// credentials with this attribute set. This way, credentials stored with
56+
// newer versions can be retrieved by older versions.
57+
//
58+
// [1]: https://github.com/docker/docker-credential-helpers/blob/v0.8.2/osxkeychain/osxkeychain.c#L66
59+
item.SetAuthenticationType("dflt")
4960
if err := splitServer(creds.ServerURL, item); err != nil {
5061
return err
5162
}

0 commit comments

Comments
 (0)