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
- How to set up user authentication and authorization (XSUAA)
31
30
32
31
---
33
32
34
33
35
-
## Setup XSUAA
34
+
[ACCORDION-BEGIN [Step 1: ](Setup XSUAA)]
36
35
37
-
Run the following command in your project folder:
36
+
1.Run the following command in your project folder:
38
37
39
38
```Shell/Bash
40
39
cds add xsuaa --for production
@@ -45,9 +44,7 @@ What happens here? Running `cds add xsuaa` does two things:
45
44
- Adds the XSUAA service to the `package.json` file of your project
46
45
- Creates the XSUAA security configuration for your project
47
46
48
-
### Adding the XSUAA service
49
-
50
-
Check if the following lines have been added to the `package.json` in your `cpapp` project:
47
+
2. Check if the following lines have been added to the `package.json` in your `cpapp` project:
51
48
52
49
<!-- cpes-file package.json:$.cds.requires -->
53
50
```JSON[7-9]
@@ -66,13 +63,19 @@ Check if the following lines have been added to the `package.json` in your `cpap
66
63
}
67
64
```
68
65
69
-
### Roles and scopes
66
+
[DONE]
67
+
[ACCORDION-END]
68
+
---
69
+
[ACCORDION-BEGIN [Step 2: ](Roles and scopes)]
70
70
71
71
A scope represents a single authorization to perform an action. For example, there could be a scope "Read" and a scope "Write". The scope allows a user to read or write a certain business object. Scopes can't be assigned to users directly. They're packaged into roles. For example, there could a role "Editor" consisting of the "Read" and "Write" scopes, while the role "Viewer" consists only of the "Read" scope.
Check the file `xs-security.json` that was created in your `cpapp` project. The file contains the configuration of the XSUAA (XS User Authentication and Authorization service). The CAP server takes the authorization parts `@(restrict ... )` from our service definition form and creates scopes and role templates from it. For example, it found the roles `RiskViewer` and `RiskManager` in the `srv/risk-service.cds` file:
78
+
Check the `xs-security.json` file that was created in your `cpapp` project. The file contains the configuration of the XSUAA (XS User Authentication and Authorization service). The CAP server takes the authorization parts `@(restrict ... )` from our service definition form and creates scopes and role templates from it. For example, it found the roles `RiskViewer` and `RiskManager` in the `srv/risk-service.cds` file:
76
79
77
80
```JavaScript[4,8]
78
81
entity Risks @(restrict : [
@@ -122,8 +125,6 @@ And created scopes and roles for both in the `xs-security.json` file:
0 commit comments