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"
|
||||
"crypto/sha256"
|
||||
"crypto/tls"
|
||||
b64 "encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
|
|
@ -101,7 +102,11 @@ func getImageDigest(registry, image, tag, username, password string, insecureSki
|
|||
}
|
||||
|
||||
if username != "" {
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue