Skip to content

Commit 32ba92d

Browse files
committed
1 parent 0130524 commit 32ba92d

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

ydb/core/protos/replication.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ message TReplicationConfig {
2828
// credentials
2929
oneof Credentials {
3030
TStaticCredentials StaticCredentials = 3;
31+
string OAuthToken = 7;
3132
}
3233

3334
// targets to be replicated

ydb/core/tx/replication/controller/replication.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ class TReplication::TImpl {
9292
case NKikimrReplication::TReplicationConfig::kStaticCredentials:
9393
ydbProxy.Reset(CreateYdbProxy(Config.GetSrcEndpoint(), Config.GetSrcDatabase(), Config.GetStaticCredentials()));
9494
break;
95+
case NKikimrReplication::TReplicationConfig::kOAuthToken:
96+
ydbProxy.Reset(CreateYdbProxy(Config.GetSrcEndpoint(), Config.GetSrcDatabase(), Config.GetOAuthToken()));
97+
break;
9598
default:
9699
ErrorState(TStringBuilder() << "Unexpected credentials: " << Config.GetCredentialsCase());
97100
break;

ydb/core/tx/replication/ut_helpers/test_env.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ class TEnv {
6060
}
6161
}
6262

63+
explicit TEnv(const TString& builtin)
64+
: TEnv(false)
65+
{
66+
UNIT_ASSERT_STRING_CONTAINS(builtin, "@builtin");
67+
Init(builtin);
68+
Client.ModifyOwner("/", DomainName, builtin);
69+
}
70+
6371
explicit TEnv(const TString& user, const TString& password)
6472
: TEnv(false)
6573
{

ydb/core/tx/replication/ydb_proxy/ydb_proxy_ut.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,17 @@ Y_UNIT_TEST_SUITE(YdbProxy) {
155155
}
156156
}
157157

158+
Y_UNIT_TEST(OAuthToken) {
159+
TEnv<true> env("user@builtin");
160+
// make dir
161+
{
162+
auto ev = env.Send<TEvYdbProxy::TEvMakeDirectoryResponse>(
163+
new TEvYdbProxy::TEvMakeDirectoryRequest("/Root/dir", {}));
164+
UNIT_ASSERT(ev);
165+
UNIT_ASSERT(ev->Get()->Result.IsSuccess());
166+
}
167+
}
168+
158169
Y_UNIT_TEST(CreateTable) {
159170
TEnv<false> env;
160171
// invalid key

0 commit comments

Comments
 (0)