-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
api.proto
240 lines (190 loc) · 4.84 KB
/
api.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
syntax = "proto3";
package authz;
option go_package = "github.com/eko/authz/backend/pkg/authz";
service Api {
rpc Authenticate (AuthenticateRequest) returns (AuthenticateResponse) {}
rpc Check (CheckRequest) returns (CheckResponse) {}
rpc PolicyCreate (PolicyCreateRequest) returns (PolicyCreateResponse) {}
rpc PolicyGet (PolicyGetRequest) returns (PolicyGetResponse) {}
rpc PolicyDelete (PolicyDeleteRequest) returns (PolicyDeleteResponse) {}
rpc PolicyUpdate (PolicyUpdateRequest) returns (PolicyUpdateResponse) {}
rpc PrincipalCreate (PrincipalCreateRequest) returns (PrincipalCreateResponse) {}
rpc PrincipalGet (PrincipalGetRequest) returns (PrincipalGetResponse) {}
rpc PrincipalDelete (PrincipalDeleteRequest) returns (PrincipalDeleteResponse) {}
rpc PrincipalUpdate (PrincipalUpdateRequest) returns (PrincipalUpdateResponse) {}
rpc ResourceCreate (ResourceCreateRequest) returns (ResourceCreateResponse) {}
rpc ResourceGet (ResourceGetRequest) returns (ResourceGetResponse) {}
rpc ResourceDelete (ResourceDeleteRequest) returns (ResourceDeleteResponse) {}
rpc ResourceUpdate (ResourceUpdateRequest) returns (ResourceUpdateResponse) {}
rpc RoleCreate (RoleCreateRequest) returns (RoleCreateResponse) {}
rpc RoleGet (RoleGetRequest) returns (RoleGetResponse) {}
rpc RoleDelete (RoleDeleteRequest) returns (RoleDeleteResponse) {}
rpc RoleUpdate (RoleUpdateRequest) returns (RoleUpdateResponse) {}
}
message Attribute {
string key = 1;
string value = 2;
}
message AuthenticateRequest {
string client_id = 1;
string client_secret = 2;
}
message AuthenticateResponse {
string token = 1;
string type = 2;
int64 expires_in = 3;
}
message Check {
string principal = 1;
string resource_kind = 2;
string resource_value = 3;
string action = 4;
}
message CheckAnswer {
string principal = 1;
string resource_kind = 2;
string resource_value = 3;
string action = 4;
bool is_allowed = 5;
}
message CheckRequest {
repeated Check checks = 1;
}
message CheckResponse {
repeated CheckAnswer checks = 1;
}
message Policy {
string id = 1;
repeated string actions = 2;
repeated string resources = 3;
repeated string attribute_rules = 4;
}
message PolicyCreateRequest {
string id = 1;
repeated string actions = 2;
repeated string resources = 3;
repeated string attribute_rules = 4;
}
message PolicyCreateResponse {
Policy policy = 1;
}
message PolicyGetRequest {
string id = 1;
}
message PolicyGetResponse {
Policy policy = 1;
}
message PolicyDeleteRequest {
string id = 1;
}
message PolicyDeleteResponse {
bool success = 1;
}
message PolicyUpdateRequest {
string id = 1;
repeated string actions = 2;
repeated string resources = 3;
repeated string attribute_rules = 4;
}
message PolicyUpdateResponse {
Policy policy = 1;
}
message Principal {
string id = 1;
repeated string roles = 2;
repeated Attribute attributes = 3;
}
message PrincipalCreateRequest {
string id = 1;
repeated string roles = 2;
repeated Attribute attributes = 3;
}
message PrincipalCreateResponse {
Principal principal = 1;
}
message PrincipalGetRequest {
string id = 1;
}
message PrincipalGetResponse {
Principal principal = 1;
}
message PrincipalDeleteRequest {
string id = 1;
}
message PrincipalDeleteResponse {
bool success = 1;
}
message PrincipalUpdateRequest {
string id = 1;
repeated string roles = 2;
repeated Attribute attributes = 3;
}
message PrincipalUpdateResponse {
Principal principal = 1;
}
message Resource {
string id = 1;
string kind = 2;
string value = 3;
repeated Attribute attributes = 4;
}
message ResourceCreateRequest {
string id = 1;
string kind = 2;
string value = 3;
repeated Attribute attributes = 4;
}
message ResourceCreateResponse {
Resource resource = 1;
}
message ResourceGetRequest {
string id = 1;
}
message ResourceGetResponse {
Resource resource = 1;
}
message ResourceDeleteRequest {
string id = 1;
}
message ResourceDeleteResponse {
bool success = 1;
}
message ResourceUpdateRequest {
string id = 1;
string kind = 2;
string value = 3;
repeated Attribute attributes = 4;
}
message ResourceUpdateResponse {
Resource resource = 1;
}
message Role {
string id = 1;
repeated string policies = 2;
}
message RoleCreateRequest {
string id = 1;
repeated string policies = 2;
}
message RoleCreateResponse {
Role role = 1;
}
message RoleGetRequest {
string id = 1;
}
message RoleGetResponse {
Role role = 1;
}
message RoleDeleteRequest {
string id = 1;
}
message RoleDeleteResponse {
bool success = 1;
}
message RoleUpdateRequest {
string id = 1;
repeated string policies = 2;
}
message RoleUpdateResponse {
Role role = 1;
}