@@ -85,7 +85,7 @@ async Task AuthenticateSASL(List<string> mechanisms, string username, bool async
8585 var sslStream = ( SslStream ) _stream ;
8686 if ( sslStream . RemoteCertificate is null )
8787 {
88- Logger . LogWarning ( "Remote certificate null, falling back to SCRAM-SHA-256" ) ;
88+ ConnectionLogger . LogWarning ( "Remote certificate null, falling back to SCRAM-SHA-256" ) ;
8989 }
9090 else
9191 {
@@ -95,7 +95,7 @@ async Task AuthenticateSASL(List<string> mechanisms, string username, bool async
9595 var algorithmName = remoteCertificate . SignatureAlgorithm . FriendlyName ;
9696 if ( algorithmName is null )
9797 {
98- Logger . LogWarning ( "Signature algorithm was null, falling back to SCRAM-SHA-256" ) ;
98+ ConnectionLogger . LogWarning ( "Signature algorithm was null, falling back to SCRAM-SHA-256" ) ;
9999 }
100100 else if ( algorithmName . StartsWith ( "sha1" , StringComparison . OrdinalIgnoreCase ) ||
101101 algorithmName . StartsWith ( "md5" , StringComparison . OrdinalIgnoreCase ) ||
@@ -113,7 +113,7 @@ async Task AuthenticateSASL(List<string> mechanisms, string username, bool async
113113 }
114114 else
115115 {
116- Logger . LogWarning (
116+ ConnectionLogger . LogWarning (
117117 $ "Support for signature algorithm { algorithmName } is not yet implemented, falling back to SCRAM-SHA-256") ;
118118 }
119119
@@ -167,7 +167,7 @@ async Task AuthenticateSASL(List<string> mechanisms, string username, bool async
167167 var saslContinueMsg = Expect < AuthenticationSASLContinueMessage > ( await ReadMessage ( async ) , this ) ;
168168 if ( saslContinueMsg . AuthRequestType != AuthenticationRequestType . AuthenticationSASLContinue )
169169 throw new NpgsqlException ( "[SASL] AuthenticationSASLContinue message expected" ) ;
170- var firstServerMsg = AuthenticationSCRAMServerFirstMessage . Load ( saslContinueMsg . Payload ) ;
170+ var firstServerMsg = AuthenticationSCRAMServerFirstMessage . Load ( saslContinueMsg . Payload , ConnectionLogger ) ;
171171 if ( ! firstServerMsg . Nonce . StartsWith ( clientNonce , StringComparison . Ordinal ) )
172172 throw new NpgsqlException ( "[SCRAM] Malformed SCRAMServerFirst message: server nonce doesn't start with client nonce" ) ;
173173
@@ -201,14 +201,15 @@ async Task AuthenticateSASL(List<string> mechanisms, string username, bool async
201201 if ( saslFinalServerMsg . AuthRequestType != AuthenticationRequestType . AuthenticationSASLFinal )
202202 throw new NpgsqlException ( "[SASL] AuthenticationSASLFinal message expected" ) ;
203203
204- var scramFinalServerMsg = AuthenticationSCRAMServerFinalMessage . Load ( saslFinalServerMsg . Payload ) ;
204+ var scramFinalServerMsg = AuthenticationSCRAMServerFinalMessage . Load ( saslFinalServerMsg . Payload , ConnectionLogger ) ;
205205 if ( scramFinalServerMsg . ServerSignature != Convert . ToBase64String ( serverSignature ) )
206206 throw new NpgsqlException ( "[SCRAM] Unable to verify server signature" ) ;
207207
208208 var okMsg = Expect < AuthenticationRequestMessage > ( await ReadMessage ( async ) , this ) ;
209209 if ( okMsg . AuthRequestType != AuthenticationRequestType . AuthenticationOk )
210210 throw new NpgsqlException ( "[SASL] Expected AuthenticationOK message" ) ;
211211
212+
212213 static string GetNonce ( )
213214 {
214215 using var rncProvider = RandomNumberGenerator . Create ( ) ;
@@ -446,7 +447,7 @@ class AuthenticationCompleteException : Exception { }
446447 if ( ProvidePasswordCallback is { } passwordCallback )
447448 try
448449 {
449- Logger . LogTrace ( $ "Taking password from { nameof ( ProvidePasswordCallback ) } delegate") ;
450+ ConnectionLogger . LogTrace ( $ "Taking password from { nameof ( ProvidePasswordCallback ) } delegate") ;
450451 password = passwordCallback ( Host , Port , Settings . Database ! , username ) ;
451452 }
452453 catch ( Exception e )
@@ -467,7 +468,7 @@ class AuthenticationCompleteException : Exception { }
467468 . GetFirstMatchingEntry ( Host , Port , Settings . Database ! , username ) ;
468469 if ( matchingEntry != null )
469470 {
470- Logger . LogTrace ( "Taking password from pgpass file" ) ;
471+ ConnectionLogger . LogTrace ( "Taking password from pgpass file" ) ;
471472 password = matchingEntry . Password ;
472473 }
473474 }
0 commit comments