Skip to content

Commit

Permalink
Special message for OAuth token
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberROFL committed May 7, 2024
1 parent 3589850 commit 1001bbd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ydb/core/kqp/host/kqp_gateway_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1850,7 +1850,7 @@ class TKqpGatewayProxy : public IKikimrGateway {
params.SetDatabase(*database);
}
if (const auto& token = settings.Settings.OAuthToken) {
params.SetOAuthToken(*token);
params.MutableOAuthToken()->SetToken(*token);
}
if (const auto& creds = settings.Settings.StaticCredentials) {
params.MutableStaticCredentials()->SetUser(creds->UserName);
Expand Down
6 changes: 5 additions & 1 deletion ydb/core/protos/replication.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ message TStaticCredentials {
optional string Password = 2 [(Ydb.sensitive) = true];
}

message TOAuthToken {
optional string Token = 1 [(Ydb.sensitive) = true];
}

message TConnectionParams {
optional string Endpoint = 1;
optional string Database = 2;
// credentials
oneof Credentials {
TStaticCredentials StaticCredentials = 3;
string OAuthToken = 4 [(Ydb.sensitive) = true];
TOAuthToken OAuthToken = 4;
}
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/replication/controller/replication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class TReplication::TImpl {
ydbProxy.Reset(CreateYdbProxy(params.GetEndpoint(), params.GetDatabase(), params.GetStaticCredentials()));
break;
case NKikimrReplication::TConnectionParams::kOAuthToken:
ydbProxy.Reset(CreateYdbProxy(params.GetEndpoint(), params.GetDatabase(), params.GetOAuthToken()));
ydbProxy.Reset(CreateYdbProxy(params.GetEndpoint(), params.GetDatabase(), params.GetOAuthToken().GetToken()));
break;
default:
if (!(State == EState::Removing && !Targets)) {
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/tx/replication/service/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ struct TCredentialsKey: std::tuple<TString, TString, TString> {
case NKikimrReplication::TConnectionParams::kStaticCredentials:
return TCredentialsKey(params.GetEndpoint(), params.GetDatabase(), params.GetStaticCredentials().GetUser());
case NKikimrReplication::TConnectionParams::kOAuthToken:
return TCredentialsKey(params.GetEndpoint(), params.GetDatabase(), params.GetOAuthToken() /* TODO */);
return TCredentialsKey(params.GetEndpoint(), params.GetDatabase(), params.GetOAuthToken().GetToken() /* TODO */);
default:
Y_ABORT("Unexpected credentials");
}
Expand Down Expand Up @@ -187,7 +187,7 @@ class TReplicationService: public TActorBootstrapped<TReplicationService> {
ydbProxy = GetOrCreateYdbProxy(TCredentialsKey::FromParams(params), params.GetStaticCredentials());
break;
case NKikimrReplication::TConnectionParams::kOAuthToken:
ydbProxy = GetOrCreateYdbProxy(TCredentialsKey::FromParams(params), params.GetOAuthToken());
ydbProxy = GetOrCreateYdbProxy(TCredentialsKey::FromParams(params), params.GetOAuthToken().GetToken());
break;
default:
Y_ABORT("Unexpected credentials");
Expand Down

0 comments on commit 1001bbd

Please sign in to comment.