mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-20 22:59:42 -05:00
fix: correct authentication for ghcr.io registry(#349)
Co-authored-by: Martin <Junkern@users.noreply.github.com>
This commit is contained in:
parent
0beb476c08
commit
3c22540321
1 changed files with 6 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
b64 "encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
@ -101,7 +102,11 @@ func getImageDigest(registry, image, tag, username, password string, insecureSki
|
||||||
}
|
}
|
||||||
|
|
||||||
if username != "" {
|
if username != "" {
|
||||||
req.SetBasicAuth(username, password)
|
if registry != "ghcr.io" {
|
||||||
|
req.SetBasicAuth(username, password)
|
||||||
|
} else {
|
||||||
|
req.Header.Add("Authorization", "Bearer "+b64.StdEncoding.EncodeToString([]byte(password)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We accept schema v2 manifests and manifest lists, and also OCI types
|
// We accept schema v2 manifests and manifest lists, and also OCI types
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue