You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once you have designed the structure of your model, it's time to build your database of <Glossary>object</Glossary>s and <Glossary>edge</Glossary>s in UserClouds. This can be done in two steps:
16
16
17
17
<Steps>
18
-
<Step>Migrate over from a pre-existing identity system </Step>
19
-
<Step>
20
-
Implement UserClouds's APIs to [populate the graph with
21
-
objects](/docs/reference/post_authz-objects) and
22
-
[edges](/docs/reference/post_authz-edges) on an ongoing basis
23
-
</Step>
18
+
<Step>Migrate over from a pre-existing identity system </Step>
19
+
<Step>
20
+
Implement UserClouds's APIs to [populate the graph with
21
+
objects](/docs/reference/authz/objects/post) and
22
+
[edges](/docs/reference/authz/edges/post) on an ongoing basis
23
+
</Step>
24
24
</Steps>
25
25
26
26
If you are building your product or user base from scratch, you will skip straight to step 2.
@@ -31,6 +31,6 @@ UserClouds supports mass migration from pre-existing AuthN and AuthZ systems, li
31
31
32
32
## 2. Implement Write APIs in your software
33
33
34
-
Maintaining your authorization graph is simple with UserClouds's CRUD APIs. These allow you to [create Objects](/docs/reference/post_authz-objects) and [Edges](/docs/reference/post_authz-edges) programmatically in your application.
34
+
Maintaining your authorization graph is simple with UserClouds's CRUD APIs. These allow you to [create Objects](/docs/reference/authz/objects/post) and [Edges](/docs/reference/authz/edges/post) programmatically in your application.
35
35
36
-
For more information on the APIs for Authorization, check out our [Authorization API Docs](/docs/reference/post_authz-objects).
36
+
For more information on the APIs for Authorization, check out our [Authorization API Docs](/docs/reference/authz/objects/post).
Copy file name to clipboardExpand all lines: content/docs/guides/(authorization)/Implement-AuthZ-in-3-steps/3-run-permissions-checks.mdx
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,11 @@ hidden: false
6
6
createdAt: "Thu Aug 03 2023 23:22:50 GMT+0000 (Coordinated Universal Time)"
7
7
updatedAt: "Thu Jun 06 2024 17:25:04 GMT+0000 (Coordinated Universal Time)"
8
8
---
9
-
Once you have populated UserClouds with your types, objects and edges, UserClouds is ready to be the source-of-truth for permissions. To implement <Glossary>permission</Glossary>s in your system, all you need to do is add UserClouds's [Permission Check APIs](/docs/reference/get_authz-checkattribute) in the appropriate places in your software.
9
+
10
+
Once you have populated UserClouds with your types, objects and edges, UserClouds is ready to be the source-of-truth for permissions. To implement <Glossary>permission</Glossary>s in your system, all you need to do is add UserClouds's [Permission Check APIs](/docs/reference/authz/checkattribute) in the appropriate places in your software.
10
11
11
12
-**CheckAttribute** answers the question: does user X have permission Y on object Z?
12
13
-**ListAttributes** receives a source object ID and target object ID. It returns a list of attributes that the source object has on the target object.
13
14
-**ListObjectsReachableWithAttribute** receives an attribute and a source object ID. It returns a list of objects reachable with that attribute.
14
15
15
-
For more information, check out our [Authorization API Docs](/docs/reference/get_authz-checkattribute).
16
+
For more information, check out our [Authorization API Docs](/docs/reference/authz/checkattribute).
Access Policies control the circumstances under which data can be retrieved or edited. These policies are functions that receive contextual data and return true or false to determine whether access is allowed or denied. The context is generated from the server and can be combined with additional context sent from the client.
10
11
11
12
Access Policies are executed in three places in UserClouds:
@@ -43,7 +44,7 @@ Access policies evaluate claims and key/value pairs in the provided context. The
43
44
-**context.server.purpose_names**: the purposes specified on an accessor to which this access policy is attached (does not apply in all cases)
44
45
-**context.server.ip_address**: the IP address of the user or system initiating the request
45
46
-**context.client**: This context contains key/value pairs specified in the request comments by the client and is not considered trusted. It includes data such as user-specified parameters that are not verified by the server.
46
-
-**context.user**: Information about data for the user whose data is row being accessed.
47
+
-**context.user**: Information about data for the user whose data is row being accessed.
47
48
evaluated by the access policy
48
49
-**context.query**: Specific query parameters relevant to the request.
49
50
-**context.row_data**: Specific Column data for the user row data values related to being evaluated by the request.
@@ -57,19 +58,19 @@ Access Policies are composed from Access Policy Templates. Templates are paramet
57
58
### Template function
58
59
59
60
```javascript
60
-
functiongetAge(DOB) {
61
-
consttoday=newDate();
62
-
constbirthDate=newDate(DOB);
63
-
let age =today.getFullYear() -birthDate.getFullYear();
64
-
constm=today.getMonth() -birthDate.getMonth();
65
-
if (m \<0|| (m ===0&&today.getDate() \<birthDate.getDate())) {
66
-
age--;
67
-
}
68
-
return age;
61
+
functiongetAge(DOB) {
62
+
consttoday=newDate();
63
+
constbirthDate=newDate(DOB);
64
+
let age =today.getFullYear() -birthDate.getFullYear();
65
+
constm=today.getMonth() -birthDate.getMonth();
66
+
if (m \<0|| (m ===0&&today.getDate() \<birthDate.getDate())) {
@@ -87,10 +88,10 @@ Here is an example of how you can create a policy to check if the country claim
87
88
### Template function
88
89
89
90
```javascript
90
-
functionpolicy(context, params) {
91
-
constcountry=context.server.claims.country;
92
-
constspecifiedCountry=params.specified_country;
93
-
return country === specifiedCountry;
91
+
functionpolicy(context, params) {
92
+
constcountry=context.server.claims.country;
93
+
constspecifiedCountry=params.specified_country;
94
+
return country === specifiedCountry;
94
95
}
95
96
```
96
97
@@ -108,10 +109,10 @@ If the country information is not in the JWT but in the client context, the poli
108
109
### Template function
109
110
110
111
```javascript
111
-
functionpolicy(context, params) {
112
-
constcountry=context.client.country;
113
-
constspecifiedCountry=params.specified_country;
114
-
return country === specifiedCountry;
112
+
functionpolicy(context, params) {
113
+
constcountry=context.client.country;
114
+
constspecifiedCountry=params.specified_country;
115
+
return country === specifiedCountry;
115
116
}
116
117
```
117
118
@@ -139,13 +140,16 @@ The built-in `networkRequest` function allows you to reach external services via
139
140
This example shows how to make a network request to verify the user's country based on their IP address. Note that the interface for `networkRequest` is synchronous, as in the example below:
// Example Policy Parameters (not specified in the template function)
184
-
constparams= {}; // No specific parameters needed for this example
188
+
constparams= {}; // No specific parameters needed for this example
185
189
```
186
190
187
191
## checkAttribute
188
192
189
-
The `checkAttribute` function runs a permission check against the UserClouds authorization graph. If you are using UserClouds for authorization as a service, this can verify if a user has the necessary permissions. In short, it asks whether a given object (usually a user) has an attribute (e.g. "can-read" or "is-admin") on another object (which could be just about any entity in your system). You can read more about this in the [Authorization Documentation](/docs/reference/get_authz-checkattribute).
193
+
The `checkAttribute` function runs a permission check against the UserClouds authorization graph. If you are using UserClouds for authorization as a service, this can verify if a user has the necessary permissions. In short, it asks whether a given object (usually a user) has an attribute (e.g. "can-read" or "is-admin") on another object (which could be just about any entity in your system). You can read more about this in the [Authorization Documentation](/docs/reference/authz/checkattribute).
190
194
191
195
### Example
192
196
193
197
**Use Case: Does the calling user have view permission on the target user?**
194
198
195
199
```javascript
196
200
functionpolicy(context) {
197
-
constcallingUserId=context.user.id;
198
-
consttargetUserId=context.params.targetUserId;
199
-
constattribute="viewPermission";
200
-
if (!callingUserId ||!targetUserId ||!attribute) {
UserClouds has several built-in access policies for common use cases, like role-based and time-based expiration of data. However you can also create custom policies, in two ways:
230
234
231
-
- Call the [CreateAccessPolicy API](/docs/reference/post_tokenizer-policies-access)
235
+
- Call the [CreateAccessPolicy API](/docs/reference/tokenizer/policies/access/post)
232
236
- Compose a new policy from existing policies and parametrizable templates in the UserClouds Console
233
237
234
238
To learn more about creating access policies, see our How to Guide on Creating Access Policies.
Accessors are configurable APIs that allow a client to retrieve data from the user store. Accessors are intended to be use-case specific. For example, you might configure two separate accessors `GetEmailForMarketing` and `GetEmailForAuthentication`. They enforce data usage policies and minimize outbound data from the store for their given use case.
10
11
11
12
As an example of data minimization, you might configure an accessor called `GetPhoneCountryCodeForAnalytics` that returns the country code of a user's phone number when called, instead of the raw phone number. This reduces the sensitivity of the data outside your store, minimizing your surface area for an attack and simplifying compliance.
@@ -25,7 +26,7 @@ Accessors can be configured to access either live or soft-deleted data. Soft-del
25
26
2.**Column-default access policies**: Column default policies for all columns accessed by the accessor are applied, unless overridden. Learn more [here](/docs/protect-a-column-with-defaults).
26
27
3.**Accessor-specific access policy composition**: Applied in addition to the above policies.
27
28
4. User data is further filtered according to whether the users have consented to the accessor's data processing purpose.
28
-
5. For records where access is granted, the accessor's <Glossary>data transformer</Glossary>s transform each column of the outbound data, minimizing the data for the given use case. If no transformer is specified for a given column, the column's default transformer is used. Learn more [here](/docs/protect-a-column-with-defaults).
29
+
5. For records where access is granted, the accessor's <Glossary>data transformer</Glossary>s transform each column of the outbound data, minimizing the data for the given use case. If no transformer is specified for a given column, the column's default transformer is used. Learn more [here](/docs/protect-a-column-with-defaults).
29
30
30
31
## Structure of an Accessor
31
32
@@ -42,4 +43,4 @@ At creation time, each accessor is associated with a user record <Glossary>selec
42
43
For more info on accessors, see:
43
44
44
45
-[Creating an accessor](/docs/create-an-accessor)
45
-
-[Executing an accessor](/docs/reference/post_userstore-api-accessors)
46
+
-[Executing an accessor](/docs/reference/userstore/api/accessors)
Transformers are re-usable functions that manipulate data in UserClouds. They allow you to minimize the data that you pass or store for each use case. This is key for complying with the data minimization principles in regulations like GDPR.
10
11
11
12

12
13
13
-
14
-
Transformers allow you to retain select structure and information from the raw data for different use cases, like sorting alphabetically, zip code analysis or simply flowing through your systems without triggering validation errors. For example, if you want to conduct analysis assessing the differences in behavior between children and adults, you may use a data transformer to pass a string indicating `child` or `adult`, instead of pulling raw Date of Birth from the store.
14
+
Transformers allow you to retain select structure and information from the raw data for different use cases, like sorting alphabetically, zip code analysis or simply flowing through your systems without triggering validation errors. For example, if you want to conduct analysis assessing the differences in behavior between children and adults, you may use a data transformer to pass a string indicating `child` or `adult`, instead of pulling raw Date of Birth from the store.
15
15
16
16
Transformers are executed in two places:
17
17
@@ -24,7 +24,7 @@ In addition, column default transformers provide a way to consistently apply tra
24
24
25
25
## Examples of Transformers
26
26
27
-
Transformers range from the simplest UUID function that replaces any given data with a unique identifier, to custom-written Javascript that runs in a carefully-controlled sandbox.
27
+
Transformers range from the simplest UUID function that replaces any given data with a unique identifier, to custom-written Javascript that runs in a carefully-controlled sandbox.
28
28
29
29

30
30
@@ -65,7 +65,7 @@ A transformer consists of:
65
65
66
66
UserClouds has several off-the-shelf transformers for common use cases, like masking emails, national ID numbers and credit card details. However you can also create custom functions, in three ways:
67
67
68
-
1. Call the [CreateTransformer API](/docs/reference/post_tokenizer-policies-transformation)
68
+
1. Call the [CreateTransformer API](/docs/reference/tokenizer/policies/transformation/post)
69
69
2. Create functions in the UserClouds UI
70
70
71
71
For more info on creating transformers, see our How To Guide on Creating a Transformer.
This guide explains how to update and use global baseline policies.
10
11
11
12
Global baseline policies are access policies that get applied by default to all accessors (or mutators). These policies ensure a consistent security baseline across all data operations. Global baseline policies cannot be overridden for individual accessors or mutators.
@@ -21,7 +22,7 @@ Global baseline policies are access policies that get applied by default to all
21
22
22
23
## Setting Global Baseline Policies
23
24
24
-
Global baseline policies are provisioned during tenant creation. They can be found and edited on the access policies page. These policies can be composed of other policies and templates. Additionally, they can be edited via the Update Access Policy API. For more details on editing global baseline policies, see the [API reference](/docs/reference/put_tokenizer-policies-access-id).
25
+
Global baseline policies are provisioned during tenant creation. They can be found and edited on the access policies page. These policies can be composed of other policies and templates. Additionally, they can be edited via the Update Access Policy API. For more details on editing global baseline policies, see the [API reference](/docs/reference/tokenizer/policies/access/get).
0 commit comments