mirror of
https://github.com/minio/minio.git
synced 2025-11-10 05:59:43 -05:00
Support mTLS Authentication in Webhooks (#9777)
This commit is contained in:
@@ -185,6 +185,14 @@ func (c *Certs) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, er
|
||||
return c.cert, nil
|
||||
}
|
||||
|
||||
// GetClientCertificate returns the loaded certificate for use by
|
||||
// the TLSConfig fields GetClientCertificate field in a http.Server.
|
||||
func (c *Certs) GetClientCertificate(_ *tls.CertificateRequestInfo) (*tls.Certificate, error) {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
return c.cert, nil
|
||||
}
|
||||
|
||||
// Stop tells loader to stop watching for changes to the
|
||||
// certificate and key files.
|
||||
func (c *Certs) Stop() {
|
||||
|
||||
@@ -93,6 +93,16 @@ func TestValidPairAfterWrite(t *testing.T) {
|
||||
if !reflect.DeepEqual(gcert.Certificate, expectedCert.Certificate) {
|
||||
t.Error("certificate doesn't match expected certificate")
|
||||
}
|
||||
|
||||
rInfo := &tls.CertificateRequestInfo{}
|
||||
gcert, err = c.GetClientCertificate(rInfo)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(gcert.Certificate, expectedCert.Certificate) {
|
||||
t.Error("client certificate doesn't match expected certificate")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStop(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user