forked from github/dynamiclistener
Add dumb hook to set the organization in the client cert
This commit is contained in:
parent
30cb223867
commit
12c01f1e2b
@ -10,6 +10,7 @@ import (
|
||||
"math"
|
||||
"math/big"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -59,6 +60,12 @@ func NewSignedClientCert(signer crypto.Signer, caCert *x509.Certificate, caKey c
|
||||
},
|
||||
}
|
||||
|
||||
parts := strings.Split(cn, ",o=")
|
||||
if len(parts) > 1 {
|
||||
parent.Subject.CommonName = parts[0]
|
||||
parent.Subject.Organization = parts[1:]
|
||||
}
|
||||
|
||||
cert, err := x509.CreateCertificate(rand.Reader, &parent, caCert, signer.Public(), caKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user