Fix base64 encoding style in webhookcachefiller.

This was previously using the unpadded (raw) base64 encoder, which worked sometimes (if the CA happened to be a length that didn't require padding). The correct encoding is the `base64.StdEncoding` one that includes padding.

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Matt Moyer 2020-09-15 13:54:19 -05:00
parent b1ea04b036
commit 1c7b3c3072
No known key found for this signature in database
GPG Key ID: EAE88AD172C5AE2D
2 changed files with 2 additions and 2 deletions

View File

@ -123,5 +123,5 @@ func getCABundle(spec *idpv1alpha1.TLSSpec) ([]byte, error) {
if spec == nil {
return nil, nil
}
return base64.RawStdEncoding.DecodeString(spec.CertificateAuthorityData)
return base64.StdEncoding.DecodeString(spec.CertificateAuthorityData)
}

View File

@ -159,7 +159,7 @@ func TestNewWebhookAuthenticator(t *testing.T) {
spec := &idpv1alpha1.WebhookIdentityProviderSpec{
Endpoint: url,
TLS: &idpv1alpha1.TLSSpec{
CertificateAuthorityData: base64.RawStdEncoding.EncodeToString([]byte(caBundle)),
CertificateAuthorityData: base64.StdEncoding.EncodeToString([]byte(caBundle)),
},
}
res, err := newWebhookAuthenticator(spec, ioutil.TempFile, clientcmd.WriteToFile)