@@ -38,6 +38,20 @@ bool TGRpcRequestProxyHandleMethods::ValidateAndReplyOnError(TCtx* ctx) {
38
38
}
39
39
}
40
40
41
+ inline const TVector<TEvTicketParser::TEvAuthorizeTicket::TEntry>& GetEntriesForAuthAndCheckRequest (TEvRequestAuthAndCheck::TPtr& ev) {
42
+ if (ev->Get ()->YdbToken && ev->Get ()->YdbToken ->StartsWith (" Bearer" )) {
43
+ if (AppData ()->AuthConfig .GetUseAccessService ()
44
+ && (AppData ()->DomainsConfig .GetSecurityConfig ().ViewerAllowedSIDsSize () > 0 || AppData ()->DomainsConfig .GetSecurityConfig ().MonitoringAllowedSIDsSize () > 0 )) {
45
+ static TVector<NKikimr::TEvTicketParser::TEvAuthorizeTicket::TEntry> entries = {
46
+ {NKikimr::TEvTicketParser::TEvAuthorizeTicket::ToPermissions ({" ydb.developerApi.get" , " ydb.developerApi.update" }), {{" gizmo_id" , " gizmo" }}}
47
+ };
48
+ return entries;
49
+ }
50
+ }
51
+ static TVector<NKikimr::TEvTicketParser::TEvAuthorizeTicket::TEntry> emptyEntries = {};
52
+ return emptyEntries;
53
+ }
54
+
41
55
template <typename TEvent>
42
56
class TGrpcRequestCheckActor
43
57
: public TGRpcRequestProxyHandleMethods
@@ -73,7 +87,7 @@ class TGrpcRequestCheckActor
73
87
}
74
88
75
89
void ProcessCommonAttributes (const TSchemeBoardEvents::TDescribeSchemeResult& schemeData) {
76
- static std::vector<TString> allowedAttributes = {" folder_id" , " service_account_id" , " database_id" , " container_id " };
90
+ static std::vector<TString> allowedAttributes = {" folder_id" , " service_account_id" , " database_id" };
77
91
TVector<std::pair<TString, TString>> attributes;
78
92
attributes.reserve (schemeData.GetPathDescription ().UserAttributesSize ());
79
93
for (const auto & attr : schemeData.GetPathDescription ().GetUserAttributes ()) {
@@ -83,6 +97,15 @@ class TGrpcRequestCheckActor
83
97
}
84
98
if (!attributes.empty ()) {
85
99
SetEntries ({{GetPermissions (), attributes}});
100
+ } else {
101
+ if constexpr (std::is_same_v<TEvent, TEvRequestAuthAndCheck>) {
102
+ if (!Request_->Get ()->GetDatabaseName ()) {
103
+ const auto & entries = GetEntriesForAuthAndCheckRequest (Request_);
104
+ if (!entries.empty ()) {
105
+ SetEntries (entries);
106
+ }
107
+ }
108
+ }
86
109
}
87
110
}
88
111
@@ -464,6 +487,12 @@ class TGrpcRequestCheckActor
464
487
ReplyBackAndDie ();
465
488
}
466
489
490
+ void HandleAndDie (TEvRequestAuthAndCheck::TPtr& ev) {
491
+ GrpcRequestBaseCtx_->FinishSpan ();
492
+ ev->Get ()->ReplyWithYdbStatus (Ydb::StatusIds::SUCCESS);
493
+ PassAway ();
494
+ }
495
+
467
496
template <typename T>
468
497
void HandleAndDie (T& event) {
469
498
GrpcRequestBaseCtx_->FinishSpan ();
0 commit comments