aboutsummaryrefslogtreecommitdiffstats
path: root/yt
diff options
context:
space:
mode:
authormpereskokova <mpereskokova@yandex-team.com>2023-09-20 08:37:57 +0300
committermpereskokova <mpereskokova@yandex-team.com>2023-09-20 08:51:52 +0300
commitdd4ce1488ef6663aafaeb9f7f59f5ba860dc4624 (patch)
treefdb5e20760c6d5d1080d23fb303c394c575fbd6e /yt
parent9dfead37c3b0ec561c8474a5fe5e27aa9a7605b0 (diff)
downloadydb-dd4ce1488ef6663aafaeb9f7f59f5ba860dc4624.tar.gz
YT-19885: Send impersonation in all requests when it exists
Diffstat (limited to 'yt')
-rw-r--r--yt/cpp/mapreduce/client/client_reader.cpp5
-rw-r--r--yt/cpp/mapreduce/client/file_reader.cpp10
-rw-r--r--yt/cpp/mapreduce/client/retry_heavy_write_request.cpp4
-rw-r--r--yt/cpp/mapreduce/client/retryless_writer.h4
-rw-r--r--yt/cpp/mapreduce/raw_client/raw_requests.cpp4
5 files changed, 27 insertions, 0 deletions
diff --git a/yt/cpp/mapreduce/client/client_reader.cpp b/yt/cpp/mapreduce/client/client_reader.cpp
index 80759b12dc..5b4369ecbf 100644
--- a/yt/cpp/mapreduce/client/client_reader.cpp
+++ b/yt/cpp/mapreduce/client/client_reader.cpp
@@ -154,6 +154,11 @@ void TClientReader::CreateRequest(const TMaybe<ui32>& rangeIndex, const TMaybe<u
} else {
header.SetToken(Context_.Token);
}
+
+ if (Context_.ImpersonationUser) {
+ header.SetImpersonationUser(*Context_.ImpersonationUser);
+ }
+
auto transactionId = (ReadTransaction_ ? ReadTransaction_->GetId() : ParentTransactionId_);
header.AddTransactionId(transactionId);
diff --git a/yt/cpp/mapreduce/client/file_reader.cpp b/yt/cpp/mapreduce/client/file_reader.cpp
index fc21e0bc02..35b2133651 100644
--- a/yt/cpp/mapreduce/client/file_reader.cpp
+++ b/yt/cpp/mapreduce/client/file_reader.cpp
@@ -144,6 +144,11 @@ NHttpClient::IHttpResponsePtr TFileReader::Request(const TClientContext& context
} else {
header.SetToken(context.Token);
}
+
+ if (context.ImpersonationUser) {
+ header.SetImpersonationUser(*context.ImpersonationUser);
+ }
+
header.AddTransactionId(transactionId);
header.SetOutputFormat(TMaybe<TFormat>()); // Binary format
@@ -198,6 +203,11 @@ NHttpClient::IHttpResponsePtr TBlobTableReader::Request(const TClientContext& co
} else {
header.SetToken(context.Token);
}
+
+ if (context.ImpersonationUser) {
+ header.SetImpersonationUser(*context.ImpersonationUser);
+ }
+
header.AddTransactionId(transactionId);
header.SetOutputFormat(TMaybe<TFormat>()); // Binary format
diff --git a/yt/cpp/mapreduce/client/retry_heavy_write_request.cpp b/yt/cpp/mapreduce/client/retry_heavy_write_request.cpp
index b4e4975d7f..03a1bcfccf 100644
--- a/yt/cpp/mapreduce/client/retry_heavy_write_request.cpp
+++ b/yt/cpp/mapreduce/client/retry_heavy_write_request.cpp
@@ -37,6 +37,10 @@ void RetryHeavyWriteRequest(
header.SetToken(context.Token);
}
+ if (context.ImpersonationUser) {
+ header.SetImpersonationUser(*context.ImpersonationUser);
+ }
+
for (int attempt = 0; attempt < retryCount; ++attempt) {
TPingableTransaction attemptTx(clientRetryPolicy, context, parentId, transactionPinger->GetChildTxPinger(), TStartTransactionOptions());
diff --git a/yt/cpp/mapreduce/client/retryless_writer.h b/yt/cpp/mapreduce/client/retryless_writer.h
index d1511fc476..835fdaea3b 100644
--- a/yt/cpp/mapreduce/client/retryless_writer.h
+++ b/yt/cpp/mapreduce/client/retryless_writer.h
@@ -48,6 +48,10 @@ public:
header.SetToken(context.Token);
}
+ if (context.ImpersonationUser) {
+ header.SetImpersonationUser(*context.ImpersonationUser);
+ }
+
TString requestId = CreateGuidAsString();
auto hostName = GetProxyForHeavyRequest(context);
diff --git a/yt/cpp/mapreduce/raw_client/raw_requests.cpp b/yt/cpp/mapreduce/raw_client/raw_requests.cpp
index 26120759fd..bb1a09121d 100644
--- a/yt/cpp/mapreduce/raw_client/raw_requests.cpp
+++ b/yt/cpp/mapreduce/raw_client/raw_requests.cpp
@@ -657,6 +657,10 @@ public:
header.SetToken(context.Token);
}
+ if (context.ImpersonationUser) {
+ header.SetImpersonationUser(*context.ImpersonationUser);
+ }
+
auto hostName = GetProxyForHeavyRequest(context);
auto requestId = CreateGuidAsString();