@@ -29,6 +29,8 @@ type Conn struct {
2929 credential Credential
3030 cachingSha2FullAuth bool
3131
32+ authenticationProvider AuthenticationProvider
33+
3234 h Handler
3335
3436 stmts map [uint32 ]* Stmt
@@ -68,8 +70,8 @@ func (s *Server) NewConn(conn net.Conn, user string, password string, h Handler)
6870 return s .NewCustomizedConn (conn , p , h )
6971}
7072
71- // NewCustomizedConn: create connection with customized server settings
72- func (s * Server ) NewCustomizedConn (conn net.Conn , p CredentialProvider , h Handler ) (* Conn , error ) {
73+
74+ func (s * Server ) NewCustomizedConnWithAuth (conn net.Conn , p CredentialProvider , h Handler , a AuthenticationProvider ) (* Conn , error ) {
7375 var packetConn * packet.Conn
7476 if s .tlsConfig != nil {
7577 packetConn = packet .NewTLSConn (conn )
@@ -81,6 +83,7 @@ func (s *Server) NewCustomizedConn(conn net.Conn, p CredentialProvider, h Handle
8183 Conn : packetConn ,
8284 serverConf : s ,
8385 credentialProvider : p ,
86+ authenticationProvider : a ,
8487 h : h ,
8588 connectionID : atomic .AddUint32 (& baseConnID , 1 ),
8689 stmts : make (map [uint32 ]* Stmt ),
@@ -96,6 +99,11 @@ func (s *Server) NewCustomizedConn(conn net.Conn, p CredentialProvider, h Handle
9699 return c , nil
97100}
98101
102+ // NewCustomizedConn: create connection with customized server settings
103+ func (s * Server ) NewCustomizedConn (conn net.Conn , p CredentialProvider , h Handler ) (* Conn , error ) {
104+ return s .NewCustomizedConnWithAuth (conn , p , h , nil )
105+ }
106+
99107func (c * Conn ) handshake () error {
100108 if err := c .writeInitialHandshake (); err != nil {
101109 return err
0 commit comments