1
0
Fork 0
forked from External/ergo

accounts: Add SASL EXTERNAL handler

This commit is contained in:
Daniel Oaks 2016-09-07 21:32:58 +10:00
parent 70665850aa
commit b5e7d8968f
4 changed files with 121 additions and 40 deletions

View file

@ -16,7 +16,7 @@ import (
)
var (
errNotTls = errors.New("Not a TLS connection")
errNotTLS = errors.New("Not a TLS connection")
errNoPeerCerts = errors.New("Client did not provide a certificate")
)
@ -48,9 +48,12 @@ func (socket *Socket) Close() {
func (socket *Socket) CertFP() (string, error) {
var tlsConn, isTLS = socket.conn.(*tls.Conn)
if !isTLS {
return "", errNotTls
return "", errNotTLS
}
// ensure handehake is performed
tlsConn.Handshake()
peerCerts := tlsConn.ConnectionState().PeerCertificates
if len(peerCerts) < 1 {
return "", errNoPeerCerts