Skip to content

Commit 838d952

Browse files
authored
Merge pull request #13105 from kalexand-rh/scoping_tokens
porting info about scoping tokens
2 parents ca9534d + 0b1bc4f commit 838d952

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ Topics:
6767
File: using-service-accounts-in-applications
6868
- Name: Using a service account as an OAuth client
6969
File: using-service-accounts-as-oauth-client
70+
- Name: Scoping tokens
71+
File: tokens-scoping
7072
---
7173
Name: Users and roles
7274
Dir: users_and_roles

authentication/tokens-scoping.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[id='tokens-scoping']
2+
= Scoping tokens
3+
include::modules/common-attributes.adoc[]
4+
:context: configuring-internal-oauth
5+
toc::[]
6+
7+
include::modules/tokens-scoping-about.adoc[leveloffset=+1]

modules/tokens-scoping-about.adoc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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

Comments
 (0)