diff --git a/proxy/src/auth/backend.rs b/proxy/src/auth/backend.rs index 60460e6722..50afbd2a27 100644 --- a/proxy/src/auth/backend.rs +++ b/proxy/src/auth/backend.rs @@ -149,36 +149,32 @@ impl<'l> BackendType<'l, ClientCredentials<'_>> { }; // TODO: find a proper way to merge those very similar blocks. - let (mut node, payload) = match self { + let (mut node, password) = match self { Console(api, creds) if creds.project.is_none() => { let payload = fetch_magic_payload(client).await?; + creds.project = Some(payload.project.into()); + let node = api.wake_compute(extra, creds).await?; - let mut creds = creds.as_ref(); - creds.project = Some(payload.project.as_str().into()); - let node = api.wake_compute(extra, &creds).await?; - - (node, payload) + (node, payload.password) } // This is a hack to allow cleartext password in secure connections (wss). Console(api, creds) if creds.use_cleartext_password_flow => { let payload = fetch_plaintext_password(client).await?; let node = api.wake_compute(extra, creds).await?; - (node, payload) + (node, payload.password) } Postgres(api, creds) if creds.project.is_none() => { let payload = fetch_magic_payload(client).await?; + creds.project = Some(payload.project.into()); + let node = api.wake_compute(extra, creds).await?; - let mut creds = creds.as_ref(); - creds.project = Some(payload.project.as_str().into()); - let node = api.wake_compute(extra, &creds).await?; - - (node, payload) + (node, payload.password) } _ => return Ok(None), }; - node.config.password(payload.password); + node.config.password(password); Ok(Some(AuthSuccess { reported_auth_ok: false, value: node, diff --git a/proxy/src/auth/credentials.rs b/proxy/src/auth/credentials.rs index e1943fe44c..66ca8be73e 100644 --- a/proxy/src/auth/credentials.rs +++ b/proxy/src/auth/credentials.rs @@ -47,18 +47,6 @@ impl ClientCredentials<'_> { } } -impl<'a> ClientCredentials<'a> { - #[inline] - pub fn as_ref(&'a self) -> ClientCredentials<'a> { - Self { - user: self.user, - dbname: self.dbname, - project: self.project().map(Cow::Borrowed), - use_cleartext_password_flow: self.use_cleartext_password_flow, - } - } -} - impl<'a> ClientCredentials<'a> { pub fn parse( params: &'a StartupMessageParams,