[PD2] Client done except jwt token, login and register functions
This commit is contained in:
parent
c94831d0a2
commit
78031d8e70
16 changed files with 698 additions and 337 deletions
|
@ -11,7 +11,6 @@ import (
|
|||
"errors"
|
||||
"time"
|
||||
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
|
@ -143,25 +142,7 @@ func (k *KeyStore) GetTLSConfig() *tls.Config {
|
|||
func (k *KeyStore) GetGatewayIncomingTLSConfig() *tls.Config {
|
||||
tlsConfig := k.GetTLSConfig()
|
||||
|
||||
tlsConfig.ClientAuth = tls.RequireAnyClientCert
|
||||
tlsConfig.VerifyPeerCertificate = func(rawCerts [][]byte, _ [][]*x509.Certificate) error {
|
||||
for _, certBytes := range rawCerts {
|
||||
cert, err := x509.ParseCertificate(certBytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = k.CheckCertCA(cert); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = k.CheckCertTime(cert); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = k.CheckCertUsage(cert, "MSG SERVICE"); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
tlsConfig.ClientAuth = tls.NoClientCert
|
||||
return tlsConfig
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue