@@ -80,6 +80,8 @@ The user will hip the endpoint after authentication happens, so all attributes w
80
80
This design is inspired by the ` *AccessReview ` and ` TokenReview ` APIs.
81
81
The endpoint has no input parameters or a ` spec ` field because only the authentication result is required.
82
82
83
+ ### Request
84
+
83
85
The structure for building a request:
84
86
``` go
85
87
type SelfUserAttributesReview struct {
@@ -92,9 +94,6 @@ type SelfUserAttributesReview struct {
92
94
Status SelfUserAttributesReviewStatus ` json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
93
95
}
94
96
```
95
-
96
- On receiving a request, the Kubernetes API server fills the status with the user attributes and returns it to the user.
97
-
98
97
``` go
99
98
type SelfUserAttributesReviewStatus struct {
100
99
// User attributes of the current user.
@@ -110,8 +109,66 @@ type UserInfo struct {
110
109
}
111
110
```
112
111
112
+ On receiving a request, the Kubernetes API server fills the status with the user attributes and returns it to the user.
113
+
114
+ Request URL:
115
+ ```
116
+ GET /apis/authentication.k8s.io/v1alpha1/selfuserattributesreview
117
+ ```
118
+ Response example:
119
+
120
+ ``` json
121
+ {
122
+ "apiVersion" : " authentication.k8s.io/v1alpha1" ,
123
+ "kind" : " SelfUserAttributesReview" ,
124
+ "status" : {
125
+ "name" : " jane.doe" ,
126
+ "uid" : " b6c7cfd4-f166-11ec-8ea0-0242ac120002" ,
127
+ "groups" : [" viewers" , " editors" ],
128
+ "extra" : {
129
+ "provider_id" : " token.company.dev"
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
113
135
User attributes are known at the moment of accessing the rest API endpoint and can be extracted from the request context.
114
136
137
+ ### RBAC
138
+
139
+ RBAC rules to grant access to this API should be present in the cluster by default.
140
+ It is implied that the ` system:basic-user ` cluster role will be extended to the following:
141
+ ``` yaml
142
+ apiVersion : rbac.authorization.k8s.io/v1
143
+ kind : ClusterRole
144
+ metadata :
145
+ annotations :
146
+ rbac.authorization.kubernetes.io/autoupdate : " true"
147
+ creationTimestamp : null
148
+ labels :
149
+ kubernetes.io/bootstrapping : rbac-defaults
150
+ name : system:basic-user
151
+ rules :
152
+ - apiGroups :
153
+ - authorization.k8s.io
154
+ resources :
155
+ - selfsubjectaccessreviews
156
+ - selfsubjectrulesreviews
157
+ verbs :
158
+ - create
159
+ - apiGroups :
160
+ - authentication.k8s.io
161
+ resources :
162
+ - selfuserattributesreview
163
+ verbs :
164
+ - create
165
+ ` ` `
166
+
167
+ This API is enabled by default and can be disabled by the following kube-apiserver flag (along with the TokenReview API).
168
+ ` ` `
169
+ --runtime-config=authentication.k8s.io/v1=false
170
+ ```
171
+
115
172
### Test Plan
116
173
117
174
Unit tests covering:
@@ -141,7 +198,8 @@ Integration test covering:
141
198
142
199
- Corresponding kubectl command implemented
143
200
144
- NOTE: Should not be a part pf [ conformance tests] ( https://git.k8s.io/community/contributors/devel/sig-architecture/conformance-tests.md ) .
201
+ NOTE: Should not be a part of [ conformance tests] ( https://git.k8s.io/community/contributors/devel/sig-architecture/conformance-tests.md ) .
202
+ The fact that a user possesses a token does not necessarily imply the power to know to whom that token belongs.
145
203
146
204
## Production Readiness Review Questionnaire
147
205
244
302
###### Will enabling / using this feature result in introducing new API types?
245
303
246
304
```
247
- Group: authentication
305
+ Group: authentication.k8s.io
248
306
Kind: SelfUserAttributesReview
249
307
```
250
308
0 commit comments