Merge pull request #126 from elgnay/issue_invalid_cert

Fix invalid client certificate issue
This commit is contained in:
OpenShift Merge Robot
2021-04-08 03:43:49 -04:00
committed by GitHub
2 changed files with 0 additions and 31 deletions

View File

@@ -4,7 +4,6 @@ import (
"crypto/x509/pkix"
"errors"
"fmt"
"reflect"
"strings"
"time"
@@ -84,14 +83,6 @@ func IsCertificateValid(certData []byte, subject *pkix.Name) (bool, error) {
if cert.Subject.CommonName != subject.CommonName {
continue
}
if !reflect.DeepEqual(cert.Subject.Organization, subject.Organization) {
continue
}
if !reflect.DeepEqual(cert.Subject.OrganizationalUnit, subject.OrganizationalUnit) {
continue
}
return true, nil
}

View File

@@ -138,28 +138,6 @@ func TestIsCertificateValid(t *testing.T) {
CommonName: "wrong-common-name",
},
},
{
name: "invalid organization",
testCert: testinghelpers.NewTestCertWithSubject(pkix.Name{
CommonName: "test",
Organization: []string{"a", "b"},
}, 60*time.Second),
subject: &pkix.Name{
CommonName: "test",
Organization: []string{"c"},
},
},
{
name: "invalid organizational unit",
testCert: testinghelpers.NewTestCertWithSubject(pkix.Name{
CommonName: "test",
OrganizationalUnit: []string{"x"},
}, 60*time.Second),
subject: &pkix.Name{
CommonName: "test",
OrganizationalUnit: []string{"y", "z"},
},
},
{
name: "valid cert",
testCert: testinghelpers.NewTestCertWithSubject(pkix.Name{