首页 / API 文档 / 平台管理 / 用户角色管理 / 资源鉴权 / 资源鉴权

*资源鉴权

请求信息

请求行

POST /auth/v1/selfsubjectaccessreviews

请求体

Content-Type application/json

请求体示例

资源鉴权的请求体。

{
   "apiVersion": "authorization.k8s.io/v1",
   "kind": "SelfSubjectAccessReview",
   "spec": {
     "resourceAttributes": {
       "cluster": "business",
       "group": "auth.alauda.io",
       "namespace": "myproj05-ns02",
       "project": "myproj05",
       "resource": "userbindings",
       "verb": "create"
     }
   }
 }

请求体说明

名称 类型 是否必填项 描述
apiVersion string 查看公共参数
kind string 查看公共参数
spec object 请求体详细信息,描述了资源的期望状态。
字段路径:spec
spec.resourceAttributes object ResourceAttributes 包括对授权者接口的资源请求的可用的授权属性。
字段路径:spec.resourceAttributes
resourceAttributes.cluster string 集群名称。
字段路径:spec.resourceAttributes.cluster
resourceAttributes.group string Group 是资源的 API 组。“*” 表示所有。
字段路径:spec.resourceAttributes.group
resourceAttributes.namespace string 命名空间是被请求操作的命名空间。目前,没有命名空间和所有命名空间之间没有区别。
字段路径:spec.resourceAttributes.namespace
resourceAttributes.project string 项目名称。
字段路径:spec.resourceAttributes.project
resourceAttributes.resource string Resource 是已经存在的资源类型之一。"*"意味着所有。
字段路径:spec.resourceAttributes.resource
resourceAttributes.verb string Verb 是 kubernetes 资源 API Verb,例如:get、list、watch、create、update、delete、proxy。"*"意味着所有。
字段路径:spec.resourceAttributes.verb

返回信息

Content-Type application/json

状态码: 201

OK

返回体示例

SelfSubjectAccessReview 检查当前用户是否可以执行某个操作。没有填写 spec.namespace 意味着“在所有命名空间中”。Self 是一种特殊情况,因为用户应该始终能够检查他们是否能够执行一个操作。

{
   "apiVersion": "authorization.k8s.io/v1",
   "kind": "SelfSubjectAccessReview",
   "metadata": {
     "creationTimestamp": null
   },
   "spec": {
     "resourceAttributes": {
       "cluster": "business",
       "group": "auth.alauda.io",
       "namespace": "myproj05-ns02",
       "project": "myproj05",
       "resource": "userbindings",
       "verb": "create"
     }
   },
   "status": {
     "allowed": true
   }
 }

返回体说明

名称 类型 描述
apiVersion string 查看公共参数
kind string 查看公共参数
metadata object 查看公共参数
spec object SelfSubjectAccessReviewSpec 是对访问请求的描述。必须准确地设置 ResourceAuthorizationAttributes 和 NonResourceAuthorizationAttributes 中的一个。
字段路径:spec
spec.resourceAttributes object ResourceAttributes 包括对授权者接口的资源请求的可用的授权属性。
字段路径:spec.resourceAttributes
resourceAttributes.group string Group 是资源的 API 组。“*” 表示所有。
字段路径:spec.resourceAttributes.group
resourceAttributes.namespace string 命名空间是被请求操作的命名空间。目前,没有命名空间和所有命名空间之间没有区别。
字段路径:spec.resourceAttributes.namespace
resourceAttributes.resource string Resource 是已经存在的资源类型之一。"*"意味着所有。
字段路径:spec.resourceAttributes.resource
resourceAttributes.verb string Verb 是 kubernetes 资源 API Verb,例如:get、list、watch、create、update、delete、proxy。"*"意味着所有。
字段路径:spec.resourceAttributes.verb
status object 资源鉴权状态。
字段路径:status
status.allowed boolean Allowed 是必需的。如果允许,为真,否则为假。
字段路径:status.allowed

其他状态码