Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3485283
D6253.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D6253.diff
View Options
diff --git a/services/tunnelbroker/src/libcpp/Tunnelbroker.cpp b/services/tunnelbroker/src/libcpp/Tunnelbroker.cpp
--- a/services/tunnelbroker/src/libcpp/Tunnelbroker.cpp
+++ b/services/tunnelbroker/src/libcpp/Tunnelbroker.cpp
@@ -177,6 +177,11 @@
void updateSessionItemDeviceToken(
rust::Str sessionID,
rust::Str newNotifToken) {
+ if (comm::network::config::ConfigManager::getInstance().isParameterSet(
+ comm::network::config::ConfigManager::
+ OPTION_SESSIONS_SKIP_AUTH_KEY)) {
+ return;
+ }
comm::network::database::DatabaseManager::getInstance()
.updateSessionItemDeviceToken(
std::string{sessionID}, std::string{newNotifToken});
diff --git a/services/tunnelbroker/src/server/mod.rs b/services/tunnelbroker/src/server/mod.rs
--- a/services/tunnelbroker/src/server/mod.rs
+++ b/services/tunnelbroker/src/server/mod.rs
@@ -1,11 +1,12 @@
-use crate::cxx_bridge::ffi::MessageItem;
+use crate::cxx_bridge::ffi::{MessageItem, SessionItem};
use super::constants;
use super::cxx_bridge::ffi::{
ackMessageFromAMQP, eraseMessagesFromAMQP, getMessagesFromDatabase,
- getSavedNonceToSign, getSessionItem, newSessionHandler, removeMessages,
- sendMessages, sessionSignatureHandler, updateSessionItemDeviceToken,
- updateSessionItemIsOnline, waitMessageFromDeliveryBroker, GRPCStatusCodes,
+ getSavedNonceToSign, getSessionItem, isConfigParameterSet, newSessionHandler,
+ removeMessages, sendMessages, sessionSignatureHandler,
+ updateSessionItemDeviceToken, updateSessionItemIsOnline,
+ waitMessageFromDeliveryBroker, GRPCStatusCodes,
};
use anyhow::Result;
use futures::Stream;
@@ -121,22 +122,45 @@
&self,
request: Request<Streaming<tunnelbroker::MessageToTunnelbroker>>,
) -> Result<Response<Self::MessagesStreamStream>, Status> {
- let session_id = match request.metadata().get("sessionID") {
- Some(metadata_session_id) => metadata_session_id
+ let session_id: String;
+ let session_item: SessionItem;
+ if isConfigParameterSet("sessions.skip_authentication").expect(
+ "Error while checking the skip_authentication config file parameter",
+ ) {
+ session_id = String::new();
+ let device_id = request
+ .metadata()
+ .get("deviceID")
+ .expect("Expected 'deviceID' value in metadata is not provided")
.to_str()
- .expect("metadata session id was not valid UTF8")
- .to_string(),
- None => {
- return Err(Status::invalid_argument(
- "No 'sessionID' in metadata was provided",
- ))
- }
- };
- let session_item = match getSessionItem(&session_id) {
- Ok(database_item) => database_item,
- Err(err) => return Err(Status::unauthenticated(err.what())),
- };
-
+ .expect("Metadata 'deviceID' value is not a valid UTF8")
+ .to_string();
+ session_item = SessionItem {
+ deviceID: device_id,
+ publicKey: String::new(),
+ notifyToken: String::new(),
+ deviceType: 0,
+ appVersion: String::new(),
+ deviceOS: String::new(),
+ isOnline: true,
+ };
+ } else {
+ session_id = match request.metadata().get("sessionID") {
+ Some(metadata_session_id) => metadata_session_id
+ .to_str()
+ .expect("metadata session id was not valid UTF8")
+ .to_string(),
+ None => {
+ return Err(Status::invalid_argument(
+ "No 'sessionID' in metadata was provided",
+ ));
+ }
+ };
+ session_item = match getSessionItem(&session_id) {
+ Ok(database_item) => database_item,
+ Err(err) => return Err(Status::unauthenticated(err.what())),
+ };
+ }
let (tx, rx) = mpsc::channel(constants::GRPC_TX_QUEUE_SIZE);
// Through this function, we will write to the output stream from different Tokio
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 18, 7:52 PM (10 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2674586
Default Alt Text
D6253.diff (3 KB)
Attached To
Mode
D6253: [services] Tunnelbroker - Skipping session checks in a stream when `skip_authentication` flag is set
Attached
Detach File
Event Timeline
Log In to Comment