blob: 98656fbaca725fd409b1c1b2253d891b2dc8eddb [file] [log] [blame]
Matthias Andreas Benkard832a54e2019-01-29 09:27:38 +01001/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17
18// This file was autogenerated by go-to-protobuf. Do not edit it manually!
19
20syntax = 'proto2';
21
22package k8s.io.api.authorization.v1beta1;
23
24import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
25import "k8s.io/apimachinery/pkg/runtime/generated.proto";
26import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
27import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
28
29// Package-wide variables from generator "generated".
30option go_package = "v1beta1";
31
32// ExtraValue masks the value so protobuf can generate
33// +protobuf.nullable=true
34// +protobuf.options.(gogoproto.goproto_stringer)=false
35message ExtraValue {
36 // items, if empty, will result in an empty slice
37
38 repeated string items = 1;
39}
40
41// LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace.
42// Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions
43// checking.
44message LocalSubjectAccessReview {
45 // +optional
46 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
47
48 // Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace
49 // you made the request against. If empty, it is defaulted.
50 optional SubjectAccessReviewSpec spec = 2;
51
52 // Status is filled in by the server and indicates whether the request is allowed or not
53 // +optional
54 optional SubjectAccessReviewStatus status = 3;
55}
56
57// NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface
58message NonResourceAttributes {
59 // Path is the URL path of the request
60 // +optional
61 optional string path = 1;
62
63 // Verb is the standard HTTP verb
64 // +optional
65 optional string verb = 2;
66}
67
68// NonResourceRule holds information that describes a rule for the non-resource
69message NonResourceRule {
70 // Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all.
71 repeated string verbs = 1;
72
73 // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full,
74 // final step in the path. "*" means all.
75 // +optional
76 repeated string nonResourceURLs = 2;
77}
78
79// ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface
80message ResourceAttributes {
81 // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces
82 // "" (empty) is defaulted for LocalSubjectAccessReviews
83 // "" (empty) is empty for cluster-scoped resources
84 // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview
85 // +optional
86 optional string namespace = 1;
87
88 // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all.
89 // +optional
90 optional string verb = 2;
91
92 // Group is the API Group of the Resource. "*" means all.
93 // +optional
94 optional string group = 3;
95
96 // Version is the API Version of the Resource. "*" means all.
97 // +optional
98 optional string version = 4;
99
100 // Resource is one of the existing resource types. "*" means all.
101 // +optional
102 optional string resource = 5;
103
104 // Subresource is one of the existing resource types. "" means none.
105 // +optional
106 optional string subresource = 6;
107
108 // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all.
109 // +optional
110 optional string name = 7;
111}
112
113// ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant,
114// may contain duplicates, and possibly be incomplete.
115message ResourceRule {
116 // Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all.
117 repeated string verbs = 1;
118
119 // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
120 // the enumerated resources in any API group will be allowed. "*" means all.
121 // +optional
122 repeated string apiGroups = 2;
123
124 // Resources is a list of resources this rule applies to. "*" means all in the specified apiGroups.
125 // "*/foo" represents the subresource 'foo' for all resources in the specified apiGroups.
126 // +optional
127 repeated string resources = 3;
128
129 // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all.
130 // +optional
131 repeated string resourceNames = 4;
132}
133
134// SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a
135// spec.namespace means "in all namespaces". Self is a special case, because users should always be able
136// to check whether they can perform an action
137message SelfSubjectAccessReview {
138 // +optional
139 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
140
141 // Spec holds information about the request being evaluated. user and groups must be empty
142 optional SelfSubjectAccessReviewSpec spec = 2;
143
144 // Status is filled in by the server and indicates whether the request is allowed or not
145 // +optional
146 optional SubjectAccessReviewStatus status = 3;
147}
148
149// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes
150// and NonResourceAuthorizationAttributes must be set
151message SelfSubjectAccessReviewSpec {
152 // ResourceAuthorizationAttributes describes information for a resource access request
153 // +optional
154 optional ResourceAttributes resourceAttributes = 1;
155
156 // NonResourceAttributes describes information for a non-resource access request
157 // +optional
158 optional NonResourceAttributes nonResourceAttributes = 2;
159}
160
161// SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.
162// The returned list of actions may be incomplete depending on the server's authorization mode,
163// and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions,
164// or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to
165// drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns.
166// SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.
167message SelfSubjectRulesReview {
168 // +optional
169 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
170
171 // Spec holds information about the request being evaluated.
172 optional SelfSubjectRulesReviewSpec spec = 2;
173
174 // Status is filled in by the server and indicates the set of actions a user can perform.
175 // +optional
176 optional SubjectRulesReviewStatus status = 3;
177}
178
179message SelfSubjectRulesReviewSpec {
180 // Namespace to evaluate rules for. Required.
181 optional string namespace = 1;
182}
183
184// SubjectAccessReview checks whether or not a user or group can perform an action.
185message SubjectAccessReview {
186 // +optional
187 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
188
189 // Spec holds information about the request being evaluated
190 optional SubjectAccessReviewSpec spec = 2;
191
192 // Status is filled in by the server and indicates whether the request is allowed or not
193 // +optional
194 optional SubjectAccessReviewStatus status = 3;
195}
196
197// SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes
198// and NonResourceAuthorizationAttributes must be set
199message SubjectAccessReviewSpec {
200 // ResourceAuthorizationAttributes describes information for a resource access request
201 // +optional
202 optional ResourceAttributes resourceAttributes = 1;
203
204 // NonResourceAttributes describes information for a non-resource access request
205 // +optional
206 optional NonResourceAttributes nonResourceAttributes = 2;
207
208 // User is the user you're testing for.
209 // If you specify "User" but not "Group", then is it interpreted as "What if User were not a member of any groups
210 // +optional
211 optional string user = 3;
212
213 // Groups is the groups you're testing for.
214 // +optional
215 repeated string group = 4;
216
217 // Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer
218 // it needs a reflection here.
219 // +optional
220 map<string, ExtraValue> extra = 5;
221
222 // UID information about the requesting user.
223 // +optional
224 optional string uid = 6;
225}
226
227// SubjectAccessReviewStatus
228message SubjectAccessReviewStatus {
229 // Allowed is required. True if the action would be allowed, false otherwise.
230 optional bool allowed = 1;
231
232 // Denied is optional. True if the action would be denied, otherwise
233 // false. If both allowed is false and denied is false, then the
234 // authorizer has no opinion on whether to authorize the action. Denied
235 // may not be true if Allowed is true.
236 // +optional
237 optional bool denied = 4;
238
239 // Reason is optional. It indicates why a request was allowed or denied.
240 // +optional
241 optional string reason = 2;
242
243 // EvaluationError is an indication that some error occurred during the authorization check.
244 // It is entirely possible to get an error and be able to continue determine authorization status in spite of it.
245 // For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.
246 // +optional
247 optional string evaluationError = 3;
248}
249
250// SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on
251// the set of authorizers the server is configured with and any errors experienced during evaluation.
252// Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission,
253// even if that list is incomplete.
254message SubjectRulesReviewStatus {
255 // ResourceRules is the list of actions the subject is allowed to perform on resources.
256 // The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
257 repeated ResourceRule resourceRules = 1;
258
259 // NonResourceRules is the list of actions the subject is allowed to perform on non-resources.
260 // The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
261 repeated NonResourceRule nonResourceRules = 2;
262
263 // Incomplete is true when the rules returned by this call are incomplete. This is most commonly
264 // encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.
265 optional bool incomplete = 3;
266
267 // EvaluationError can appear in combination with Rules. It indicates an error occurred during
268 // rule evaluation, such as an authorizer that doesn't support rule evaluation, and that
269 // ResourceRules and/or NonResourceRules may be incomplete.
270 // +optional
271 optional string evaluationError = 4;
272}
273