@@ -50,6 +50,7 @@ use uuid::Uuid;
5050use crate :: catalog:: Catalog ;
5151use crate :: command:: {
5252 AuthResponse , CatalogDump , CatalogSnapshot , Command , ExecuteResponse , Response ,
53+ SASLChallengeResponse , SASLVerifyProofResponse ,
5354} ;
5455use crate :: coord:: { Coordinator , ExecuteContextExtra } ;
5556use crate :: error:: AdapterError ;
@@ -168,6 +169,40 @@ impl Client {
168169 Ok ( response)
169170 }
170171
172+ pub async fn generate_sasl_challenge (
173+ & self ,
174+ user : & String ,
175+ client_nonce : & String ,
176+ ) -> Result < SASLChallengeResponse , AdapterError > {
177+ let ( tx, rx) = oneshot:: channel ( ) ;
178+ self . send ( Command :: AuthenticateGetSASLChallenge {
179+ role_name : user. to_string ( ) ,
180+ nonce : client_nonce. to_string ( ) ,
181+ tx,
182+ } ) ;
183+ let response = rx. await . expect ( "sender dropped" ) ?;
184+ Ok ( response)
185+ }
186+
187+ pub async fn verify_sasl_proof (
188+ & self ,
189+ user : & String ,
190+ proof : & String ,
191+ nonce : & String ,
192+ mock_hash : & String ,
193+ ) -> Result < SASLVerifyProofResponse , AdapterError > {
194+ let ( tx, rx) = oneshot:: channel ( ) ;
195+ self . send ( Command :: AuthenticateVerifySASLProof {
196+ role_name : user. to_string ( ) ,
197+ proof : proof. to_string ( ) ,
198+ auth_message : nonce. to_string ( ) ,
199+ mock_hash : mock_hash. to_string ( ) ,
200+ tx,
201+ } ) ;
202+ let response = rx. await . expect ( "sender dropped" ) ?;
203+ Ok ( response)
204+ }
205+
171206 /// Upgrades this client to a session client.
172207 ///
173208 /// A session is a connection that has successfully negotiated parameters,
@@ -927,6 +962,8 @@ impl SessionClient {
927962 Command :: GetWebhook { .. } => typ = Some ( "webhook" ) ,
928963 Command :: Startup { .. }
929964 | Command :: AuthenticatePassword { .. }
965+ | Command :: AuthenticateGetSASLChallenge { .. }
966+ | Command :: AuthenticateVerifySASLProof { .. }
930967 | Command :: CatalogSnapshot { .. }
931968 | Command :: Commit { .. }
932969 | Command :: CancelRequest { .. }
0 commit comments