Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/backend/registrybackend/security/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -15,6 +15,7 @@ package security

import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"sync"
Expand Down Expand Up @@ -47,6 +48,7 @@ var v2Version = auth.APIVersion{
type Config struct {
TLS httputil.TLSConfig `yaml:"tls"`
BasicAuth *types.AuthConfig `yaml:"basic"`
PasswordFile string `yaml:"passwordFile"`
RemoteCredentialsStore string `yaml:"credsStore"`
EnableHTTPFallback bool `yaml:"enableHTTPFallback"`
}
Expand Down Expand Up @@ -173,6 +175,12 @@ func (c credentialStore) Basic(*url.URL) (string, string) {
if basic == nil {
return "", ""
}
if c.config.PasswordFile != "" {
passwordBytes, err := ioutil.ReadFile(c.config.PasswordFile)
if err == nil {
return basic.Username, string(passwordBytes)
}
}
return basic.Username, basic.Password
}

Expand Down