@@ -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 ;
@@ -167,6 +168,40 @@ impl Client {
167168 Ok ( response)
168169 }
169170
171+ pub async fn generate_sasl_challenge (
172+ & self ,
173+ user : & String ,
174+ client_nonce : & String ,
175+ ) -> Result < SASLChallengeResponse , AdapterError > {
176+ let ( tx, rx) = oneshot:: channel ( ) ;
177+ self . send ( Command :: AuthenticateGetSASLChallenge {
178+ role_name : user. to_string ( ) ,
179+ nonce : client_nonce. to_string ( ) ,
180+ tx,
181+ } ) ;
182+ let response = rx. await . expect ( "sender dropped" ) ?;
183+ Ok ( response)
184+ }
185+
186+ pub async fn verify_sasl_proof (
187+ & self ,
188+ user : & String ,
189+ proof : & String ,
190+ nonce : & String ,
191+ mock_hash : & String ,
192+ ) -> Result < SASLVerifyProofResponse , AdapterError > {
193+ let ( tx, rx) = oneshot:: channel ( ) ;
194+ self . send ( Command :: AuthenticateVerifySASLProof {
195+ role_name : user. to_string ( ) ,
196+ proof : proof. to_string ( ) ,
197+ auth_message : nonce. to_string ( ) ,
198+ mock_hash : mock_hash. to_string ( ) ,
199+ tx,
200+ } ) ;
201+ let response = rx. await . expect ( "sender dropped" ) ?;
202+ Ok ( response)
203+ }
204+
170205 /// Upgrades this client to a session client.
171206 ///
172207 /// A session is a connection that has successfully negotiated parameters,
@@ -908,6 +943,8 @@ impl SessionClient {
908943 Command :: GetWebhook { .. } => typ = Some ( "webhook" ) ,
909944 Command :: Startup { .. }
910945 | Command :: AuthenticatePassword { .. }
946+ | Command :: AuthenticateGetSASLChallenge { .. }
947+ | Command :: AuthenticateVerifySASLProof { .. }
911948 | Command :: CatalogSnapshot { .. }
912949 | Command :: Commit { .. }
913950 | Command :: CancelRequest { .. }
0 commit comments