|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * authentication/tokens-scoping.adoc |
| 4 | + |
| 5 | +[id='tokens-scoping-about-{context}'] |
| 6 | += About scoping tokens |
| 7 | + |
| 8 | +You can created scoped tokens to delegate some of your permissions to another |
| 9 | +user or service account. |
| 10 | +For example, a project administrator might want to delegate the |
| 11 | +power to create pods. |
| 12 | + |
| 13 | +A scoped token is a token that identifies as a given user but is limited to |
| 14 | +certain actions by its scope. Only a user with the `cluster-admin` role can create |
| 15 | +scoped tokens. |
| 16 | + |
| 17 | +Scopes are evaluated by converting the set of scopes for a token into a set of |
| 18 | +`PolicyRules`. Then, the request is matched against those rules. The request |
| 19 | +attributes must match at least one of the scope rules to be passed to the |
| 20 | +"normal" authorizer for further authorization checks. |
| 21 | + |
| 22 | +[id='scoping-tokens-user-scopes-{context}'] |
| 23 | +== User scopes |
| 24 | + |
| 25 | +User scopes are focused on getting information about a given user. They are |
| 26 | +intent-based, so the rules are automatically created for you: |
| 27 | + |
| 28 | +* `user:full` - Allows full read/write access to the API with all of the user's permissions. |
| 29 | +* `user:info` - Allows read-only access to information about the user, such as name and groups. |
| 30 | +* `user:check-access` - Allows access to `self-localsubjectaccessreviews` and `self-subjectaccessreviews`. |
| 31 | + These are the variables where you pass an empty user and groups in your request object. |
| 32 | +* `user:list-projects` - Allows read-only access to list the projects the user has access to. |
| 33 | + |
| 34 | + |
| 35 | +[id='scoping-tokens-role-scope-{context}'] |
| 36 | +== Role scope |
| 37 | +The role scope allows you to have the same level of access as a given role |
| 38 | +filtered by namespace. |
| 39 | + |
| 40 | +* `role:<cluster-role name>:<namespace or * for all>` - Limits the scope to the |
| 41 | +rules specified by the cluster-role, but only in the specified namespace . |
| 42 | ++ |
| 43 | +[NOTE] |
| 44 | +==== |
| 45 | +Caveat: This prevents escalating access. Even if the role allows access to |
| 46 | +resources like secrets, rolebindings, and roles, this scope will deny access |
| 47 | +to those resources. This helps prevent unexpected escalations. Many people do |
| 48 | +not think of a role like `edit` as being an escalating role, but with access to |
| 49 | +a secret it is. |
| 50 | +==== |
| 51 | + |
| 52 | +* `role:<cluster-role name>:<namespace or * for all>:!` - This is similar to the |
| 53 | +example above, except that including the bang causes this scope to allow |
| 54 | +escalating access. |
0 commit comments