mirror of
https://github.com/distribution/distribution.git
synced 2025-09-05 17:01:06 +00:00
Check PEM block type when reading token cert file
closes #1909 Signed-off-by: Jason Heiss <jheiss@twosigma.com>
This commit is contained in:
@@ -176,12 +176,14 @@ func newAccessController(options map[string]interface{}) (auth.AccessController,
|
||||
var rootCerts []*x509.Certificate
|
||||
pemBlock, rawCertBundle := pem.Decode(rawCertBundle)
|
||||
for pemBlock != nil {
|
||||
cert, err := x509.ParseCertificate(pemBlock.Bytes)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to parse token auth root certificate: %s", err)
|
||||
}
|
||||
if pemBlock.Type == "CERTIFICATE" {
|
||||
cert, err := x509.ParseCertificate(pemBlock.Bytes)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to parse token auth root certificate: %s", err)
|
||||
}
|
||||
|
||||
rootCerts = append(rootCerts, cert)
|
||||
rootCerts = append(rootCerts, cert)
|
||||
}
|
||||
|
||||
pemBlock, rawCertBundle = pem.Decode(rawCertBundle)
|
||||
}
|
||||
|
Reference in New Issue
Block a user