Skip to content

Commit

Permalink
Allow multiple client certs so we can provide a chain
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed Nov 11, 2022
1 parent d88accb commit 0f7a28d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions token.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func LoadClientIdentity(certPath, keyPath, caCertPath string) (*TokenId, error)
}
}

func NewClientTokenIdentity(clientCert *x509.Certificate, privateKey crypto.PrivateKey, caCerts []*x509.Certificate) *TokenId {
func NewClientTokenIdentity(clientCerts []*x509.Certificate, privateKey crypto.PrivateKey, caCerts []*x509.Certificate) *TokenId {
pool := x509.NewCertPool()

for _, ca := range caCerts {
Expand All @@ -97,14 +97,15 @@ func NewClientTokenIdentity(clientCert *x509.Certificate, privateKey crypto.Priv
Config: Config{},
certLock: sync.RWMutex{},
cert: &tls.Certificate{
Certificate: [][]byte{
clientCert.Raw,
},
Leaf: clientCert,
Leaf: clientCerts[0],
PrivateKey: privateKey,
},
ca: pool,
}

for _, cert := range clientCerts {
id.cert.Certificate = append(id.cert.Certificate, cert.Raw)
}

return NewIdentity(id)
}

0 comments on commit 0f7a28d

Please sign in to comment.