We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fe67a8 commit 8b48adeCopy full SHA for 8b48ade
pkg/client/request.go
@@ -0,0 +1,20 @@
1
+package client
2
+
3
+import (
4
+ "encoding/base64"
5
+ "encoding/json"
6
+ "fmt"
7
+ "github.com/distribution/reference"
8
+ "net/http"
9
+)
10
11
+func (c *Client) RequestAuthenticate(req *http.Request, ref reference.Named) error {
12
+ authConfig := c.authProvider.AuthConfig(ref)
13
+ confBytes, err := json.Marshal(authConfig)
14
+ if err != nil {
15
+ return fmt.Errorf("failed to marshal auth config: %w", err)
16
+ }
17
+ encoded := base64.URLEncoding.EncodeToString(confBytes)
18
+ req.Header.Set("X-Registry-Auth", encoded)
19
+ return nil
20
+}
0 commit comments