@@ -54,33 +54,28 @@ impl AuthPassthrough {
54
54
None
55
55
}
56
56
57
- /// Connects to server and executes auth_query for the specidief user .
58
- /// If the response is a row with two columns containing the user
59
- /// and its MD5 hash, the hash returned.
57
+ /// Connects to server and executes auth_query for the specified address .
58
+ /// If the response is a row with two columns containing the username set in the address.
59
+ /// and its MD5 hash, the MD5 hash returned.
60
60
///
61
61
/// Note that the query is executed, changing $1 with the name of the user
62
62
/// this is so we only hold in memory (and transfer) the least amount of 'sensitive' data.
63
63
/// Also, it is compatible with pgbouncer.
64
64
///
65
65
/// # Arguments
66
66
///
67
- /// * `address` - An Address of the server we want to connect to.
68
- /// * `user` - A user that will be used to obtain the hash.
67
+ /// * `address` - An Address of the server we want to connect to. The username for the hash will be obtained from this value.
69
68
///
70
69
/// # Examples
71
70
///
72
71
/// ```
73
72
/// use pgcat::auth_passthrough::AuthPassthrough;
74
73
/// use pgcat::config::Address;
75
74
/// let auth_passthrough = AuthPassthrough::new("SELECT * FROM public.user_lookup('$1');", "postgres", "postgres", "postgres");
76
- /// auth_passthrough.fetch_hash(&Address::default(), "foo" );
75
+ /// auth_passthrough.fetch_hash(&Address::default());
77
76
/// ```
78
77
///
79
- pub async fn fetch_hash (
80
- & self ,
81
- address : & crate :: config:: Address ,
82
- user : & str ,
83
- ) -> Result < String , Error > {
78
+ pub async fn fetch_hash ( & self , address : & crate :: config:: Address ) -> Result < String , Error > {
84
79
let auth_user = crate :: config:: User {
85
80
username : self . user . clone ( ) ,
86
81
password : Some ( self . password . clone ( ) ) ,
@@ -89,6 +84,7 @@ impl AuthPassthrough {
89
84
} ;
90
85
91
86
let client_server_map: ClientServerMap = Arc :: new ( Mutex :: new ( HashMap :: new ( ) ) ) ;
87
+ let user = & address. username ;
92
88
93
89
debug ! ( "Connecting to server to obtain auth hashes." ) ;
94
90
match Server :: startup (
0 commit comments