Page MenuHomePhabricator

D11257.id37878.diff
No OneTemporary

D11257.id37878.diff

diff --git a/keyserver/addons/rust-node-addon/src/identity_client/login.rs b/keyserver/addons/rust-node-addon/src/identity_client/login.rs
--- a/keyserver/addons/rust-node-addon/src/identity_client/login.rs
+++ b/keyserver/addons/rust-node-addon/src/identity_client/login.rs
@@ -60,31 +60,16 @@
.map_err(handle_grpc_error)?;
debug!("Received login response from identity service");
- // We need to get the load balancer cookie from from the response and send it
- // in the subsequent request to ensure it is routed to the same identity
- // service instance as the first request
- let cookie = response
- .metadata()
- .get(RESPONSE_METADATA_COOKIE_KEY)
- .cloned();
-
let login_start_response = response.into_inner();
let opaque_login_upload = client_login
.finish(&login_start_response.opaque_login_response)
.map_err(|_| Error::from_reason("Failed to finish opaque login request"))?;
- let mut login_finish_request = Request::new(OpaqueLoginFinishRequest {
+ let login_finish_request = OpaqueLoginFinishRequest {
session_id: login_start_response.session_id,
opaque_login_upload,
- });
-
- // Cookie won't be available in local dev environments
- if let Some(cookie_metadata) = cookie {
- login_finish_request
- .metadata_mut()
- .insert(REQUEST_METADATA_COOKIE_KEY, cookie_metadata);
- }
+ };
debug!("Attempting to finalize opaque login exchange with identity service");
let login_finish_response = identity_client
diff --git a/keyserver/addons/rust-node-addon/src/identity_client/mod.rs b/keyserver/addons/rust-node-addon/src/identity_client/mod.rs
--- a/keyserver/addons/rust-node-addon/src/identity_client/mod.rs
+++ b/keyserver/addons/rust-node-addon/src/identity_client/mod.rs
@@ -21,15 +21,12 @@
};
use grpc_clients::identity::protos::unauthenticated as client_proto;
use grpc_clients::identity::shared::CodeVersionLayer;
-use grpc_clients::identity::{
- REQUEST_METADATA_COOKIE_KEY, RESPONSE_METADATA_COOKIE_KEY,
-};
use lazy_static::lazy_static;
use napi::bindgen_prelude::*;
use serde::{Deserialize, Serialize};
use std::env::var;
use tonic::codegen::InterceptedService;
-use tonic::{transport::Channel, Request};
+use tonic::transport::Channel;
use tracing::{self, info, instrument, warn, Level};
use tracing_subscriber::EnvFilter;
diff --git a/keyserver/addons/rust-node-addon/src/identity_client/register_user.rs b/keyserver/addons/rust-node-addon/src/identity_client/register_user.rs
--- a/keyserver/addons/rust-node-addon/src/identity_client/register_user.rs
+++ b/keyserver/addons/rust-node-addon/src/identity_client/register_user.rs
@@ -43,11 +43,11 @@
one_time_notif_prekeys: notif_one_time_keys,
device_type: DeviceType::Keyserver.into(),
};
- let registration_start_request = Request::new(RegistrationStartRequest {
+ let registration_start_request = RegistrationStartRequest {
opaque_registration_request,
username,
device_key_upload: Some(device_key_upload),
- });
+ };
// Finish OPAQUE registration and send final registration request
let response = identity_client
@@ -56,14 +56,6 @@
.map_err(handle_grpc_error)?;
debug!("Received registration start response");
- // We need to get the load balancer cookie from from the response and send it
- // in the subsequent request to ensure it is routed to the same identity
- // service instance as the first request
- let cookie = response
- .metadata()
- .get(RESPONSE_METADATA_COOKIE_KEY)
- .cloned();
-
let registration_start_response = response.into_inner();
let opaque_registration_upload = opaque_registration
@@ -73,18 +65,10 @@
)
.map_err(|_| Error::from_status(Status::GenericFailure))?;
- let mut registration_finish_request =
- Request::new(RegistrationFinishRequest {
- session_id: registration_start_response.session_id,
- opaque_registration_upload,
- });
-
- // Cookie won't be available in local dev environments
- if let Some(cookie_metadata) = cookie {
- registration_finish_request
- .metadata_mut()
- .insert(REQUEST_METADATA_COOKIE_KEY, cookie_metadata);
- }
+ let registration_finish_request = RegistrationFinishRequest {
+ session_id: registration_start_response.session_id,
+ opaque_registration_upload,
+ };
let registration_response = identity_client
.register_password_user_finish(registration_finish_request)
diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs
--- a/native/native_rust_library/src/lib.rs
+++ b/native/native_rust_library/src/lib.rs
@@ -19,15 +19,12 @@
RegistrationFinishRequest, RegistrationStartRequest,
SecondaryDeviceKeysUploadRequest, WalletAuthRequest,
};
-use grpc_clients::identity::{
- get_auth_client, get_unauthenticated_client, REQUEST_METADATA_COOKIE_KEY,
- RESPONSE_METADATA_COOKIE_KEY,
-};
+use grpc_clients::identity::{get_auth_client, get_unauthenticated_client};
use lazy_static::lazy_static;
use serde::Serialize;
use std::sync::Arc;
use tokio::runtime::{Builder, Runtime};
-use tonic::{Request, Status};
+use tonic::Status;
use tracing::instrument;
use wallet_registration::register_wallet_user;
@@ -621,14 +618,6 @@
.register_password_user_start(registration_start_request)
.await?;
- // We need to get the load balancer cookie from from the response and send it
- // in the subsequent request to ensure it is routed to the same identity
- // service instance as the first request
- let cookie = response
- .metadata()
- .get(RESPONSE_METADATA_COOKIE_KEY)
- .cloned();
-
let registration_start_response = response.into_inner();
let opaque_registration_upload = client_registration
@@ -643,17 +632,8 @@
opaque_registration_upload,
};
- let mut finish_request = Request::new(registration_finish_request);
-
- // Cookie won't be available in local dev environments
- if let Some(cookie_metadata) = cookie {
- finish_request
- .metadata_mut()
- .insert(REQUEST_METADATA_COOKIE_KEY, cookie_metadata);
- }
-
let registration_finish_response = identity_client
- .register_password_user_finish(finish_request)
+ .register_password_user_finish(registration_finish_request)
.await?
.into_inner();
let user_id_and_access_token =
@@ -734,14 +714,6 @@
.log_in_password_user_start(login_start_request)
.await?;
- // We need to get the load balancer cookie from from the response and send it
- // in the subsequent request to ensure it is routed to the same identity
- // service instance as the first request
- let cookie = response
- .metadata()
- .get(RESPONSE_METADATA_COOKIE_KEY)
- .cloned();
-
let login_start_response = response.into_inner();
let opaque_login_upload = client_login
@@ -753,17 +725,8 @@
opaque_login_upload,
};
- let mut finish_request = Request::new(login_finish_request);
-
- // Cookie won't be available in local dev environments
- if let Some(cookie_metadata) = cookie {
- finish_request
- .metadata_mut()
- .insert(REQUEST_METADATA_COOKIE_KEY, cookie_metadata);
- }
-
let login_finish_response = identity_client
- .log_in_password_user_finish(finish_request)
+ .log_in_password_user_finish(login_finish_request)
.await?
.into_inner();
let user_id_and_access_token =
@@ -909,14 +872,6 @@
.update_user_password_start(update_password_start_request)
.await?;
- // We need to get the load balancer cookie from from the response and send it
- // in the subsequent request to ensure it is routed to the same identity
- // service instance as the first request
- let cookie = response
- .metadata()
- .get(RESPONSE_METADATA_COOKIE_KEY)
- .cloned();
-
let update_password_start_response = response.into_inner();
let opaque_registration_upload = client_registration
@@ -931,17 +886,8 @@
opaque_registration_upload,
};
- let mut finish_request = Request::new(update_password_finish_request);
-
- // Cookie won't be available in local dev environments
- if let Some(cookie_metadata) = cookie {
- finish_request
- .metadata_mut()
- .insert(REQUEST_METADATA_COOKIE_KEY, cookie_metadata);
- }
-
identity_client
- .update_user_password_finish(finish_request)
+ .update_user_password_finish(update_password_finish_request)
.await?;
Ok(())
diff --git a/shared/grpc_clients/src/identity/mod.rs b/shared/grpc_clients/src/identity/mod.rs
--- a/shared/grpc_clients/src/identity/mod.rs
+++ b/shared/grpc_clients/src/identity/mod.rs
@@ -17,5 +17,4 @@
pub use authenticated::get_auth_client;
pub use device::DeviceType;
-pub use shared::{REQUEST_METADATA_COOKIE_KEY, RESPONSE_METADATA_COOKIE_KEY};
pub use unauthenticated::get_unauthenticated_client;
diff --git a/shared/grpc_clients/src/identity/shared.rs b/shared/grpc_clients/src/identity/shared.rs
--- a/shared/grpc_clients/src/identity/shared.rs
+++ b/shared/grpc_clients/src/identity/shared.rs
@@ -4,9 +4,6 @@
Request, Status,
};
-pub const RESPONSE_METADATA_COOKIE_KEY: &str = "set-cookie";
-pub const REQUEST_METADATA_COOKIE_KEY: &str = "cookie";
-
pub struct CodeVersionLayer {
pub(crate) version: u64,
pub(crate) device_type: String,

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 8:55 AM (20 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2611089
Default Alt Text
D11257.id37878.diff (9 KB)

Event Timeline