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
Copy file name to clipboardExpand all lines: guides/security/authentication.md
+42-39Lines changed: 42 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,8 +117,8 @@ As the mock user authentication is active, all (CAP) endpoints are [authenticate
117
117
To simplify the development scenario, you can set <Configjava>cds.security.authentication.mode = "model-relaxed"</Config> to deactivate authentication of endpoints derived from unrestricted CDS services.
results in a `401` error response from the server indicating that the anonymous user has been rejected due to missing authentication.
120
+
If you stay with the standard authentication mode, sending the OData request `curl http://localhost:8080/odata/v4/CatalogService/Books --verbose`
121
+
results in a `401` error response from the server, indicating that the anonymous user has been rejected due to missing authentication.
122
122
This is the case for all endpoints including the web application page at `/index.html`.
123
123
124
124
Mock users require **basic authentication**, hence sending the same request on behalf of mock user `admin` (password: `admin`) with `curl http://admin:admin@localhost:8080/odata/v4/CatalogService/Books` returns successfully (HTTP response `200`).
@@ -127,17 +127,17 @@ Mock users require **basic authentication**, hence sending the same request on b
127
127
128
128
<divclass="impl node">
129
129
130
-
::: info
130
+
::: tip
131
131
In non-production profile, endpoints derived from unrestricted CDS services are not authenticated to simplify the development scenario.
132
132
:::
133
133
134
-
Sending OData request
134
+
Send an OData request through the restricted `AdminService` as follows:
results in a `401` error response from the server indicating that the anonymous user has been rejected due to missing authentication.
140
+
This results in a `401` error response from the server indicating that the anonymous user has been rejected due to missing authentication.
141
141
This is true for all endpoints including the web application page at `/index.html`.
142
142
143
143
Mock users require **basic authentication**, hence sending the same request on behalf of mock user `alice` (no password) with
@@ -314,7 +314,7 @@ You can best configure and test IAS authentication in the Cloud, so let's enhanc
314
314
315
315
### Get Ready with IAS { #ias-ready }
316
316
317
-
Before working with IAS on CF, you need to
317
+
Before working with IAS on CF, you need to do all of the following:
318
318
319
319
- Prepare an IAS (test) tenant. If not available yet, you need to [create](https://help.sap.com/docs/cloud-identity-services/cloud-identity-services/get-your-tenant) it now.
320
320
@@ -324,14 +324,12 @@ towards your IAS tenant to use it as identity provider for applications in your
324
324
- Ensure your development environment is [prepared for deploying](../deploy/to-cf#prerequisites) on CF,
325
325
in particular you require a `cf` CLI session targeting a CF space in the test subaccount (test with `cf target`).
326
326
327
-
You can continue with the sample [already created](#mock-user-authentication). In the project root folder, execute
327
+
You can continue with the sample [already created](#mock-user-authentication). In the project root folder, execute the following command to make your application ready for deployment to CF.
328
328
329
329
```sh
330
330
cds add mta
331
331
```
332
332
333
-
to make your application ready for deployment to CF.
334
-
335
333
<div class="impl java">
336
334
337
335
::: info
@@ -340,23 +338,23 @@ Command `add mta` will enhance the project with `cds-starter-cloudfoundry` and t
340
338
341
339
</div>
342
340
343
-
You also need to configure DB support:
341
+
You also need to configure database support:
344
342
345
-
```sh [SAP HANA]
343
+
```sh
346
344
cds add hana
347
345
```
348
346
349
347
350
348
351
349
### Adding IAS
352
350
353
-
Now the application is ready to be enhanced with IAS-support by executing
351
+
Now the application is ready to be enhanced with IAS-support:
354
352
355
353
```sh
356
354
cds add ias
357
355
```
358
356
359
-
which automatically adds a service instance named `bookshop-ias` of type `identity` (plan: `application`) and binds the CAP application to it.
357
+
This command automatically adds a service instance named `bookshop-ias` of type `identity` (plan: `application`) and binds the CAP application to it in the _mta.yaml_.
360
358
361
359
::: details Generated deployment descriptor for IAS instance and binding
362
360
```yaml [mta.yaml]
@@ -404,16 +402,16 @@ Service instance and binding offer the following crucial configuration propertie
404
402
| `app-identifier` | _binding_ | _Ensures stable subject in generated certificate (required for credential rotation)_ |
405
403
406
404
407
-
[Lean more about IAS service instance and binding configuration](https://help.sap.com/docs/cloud-identity-services/cloud-identity-services/reference-information-for-identity-service-of-sap-btp){.learn-more}
405
+
[Learn more about IAS service instance and binding configuration.](https://help.sap.com/docs/cloud-identity-services/cloud-identity-services/reference-information-for-identity-service-of-sap-btp){.learn-more}
408
406
409
407
<div id="learn-more-IAS-instances-bindings" />
410
408
411
-
Now let's pack and deploy the application with
409
+
Now let's pack and deploy the application:
410
+
412
411
```sh
413
412
cds up
414
413
```
415
414
416
-
and waituntil the application is up and running.
417
415
You can test the status with `cf apps` on CLI level or in BTP Cockpit, alternatively.
418
416
419
417
The startup log should confirm the activated IAS authentication:
@@ -434,7 +432,7 @@ TODO
434
432
435
433
</div>
436
434
437
-
::: tip
435
+
::: tip Local at this point?
438
436
The local setup is still runnable on basis of mock users as there is no IAS binding in the environment.
439
437
:::
440
438
@@ -480,7 +478,7 @@ In BTP Cockpit, service instance `bookshop-ias` appears as a link that allows di
480
478
481
479
Due to CAP's autoconfiguration, all CAP endpoints are authenticated and expect valid OAuth tokens created for the IAS application.
482
480
483
-
Sending the test request
481
+
The following request as anonymous user without a token results in a `401 Unauthorized`:
as anonymous user without a token results in a `401 Unauthorized` as expected.
504
-
505
-
Now let's fetch a token as basis for a fully authenticated test request.
501
+
This is expected. Now let's fetch a token as basis for a fully authenticated test request.
506
502
For doing so, you need to interact with IAS service which requires an authenticated client itself.
507
503
508
504
The overall setup with CLI client and the Cloud services is sketched in the diagram:
@@ -718,13 +714,21 @@ You can create a bookshop sample as described in [Mock User Authentication](#moc
718
714
719
715
Execute the following two commands in the project root folder, only if you haven't prepared your sample for IAS in the previous section already.
720
716
721
-
To make your application ready for deployment to CF:
717
+
If there is no deployment descriptor yet, execute the following in the project root folder:
722
718
723
719
```sh
724
720
cds add mta
725
721
```
726
722
727
-
You also need to configure DB support:
723
+
<div class="impl java">
724
+
725
+
::: tip
726
+
Command `add mta` will enhance the project with `cds-starter-cloudfoundry` and therefore all [dependencies required for security](../../java/security#maven-dependencies) are added transitively.
727
+
:::
728
+
729
+
</div>
730
+
731
+
You also need to configure database support:
728
732
729
733
```sh [SAP HANA]
730
734
cds add hana
@@ -877,7 +881,7 @@ If you modify the _xs-security.json_ manually, make sure that the scope names in
877
881
878
882
#### Start and Check the Deployment
879
883
880
-
Now let's pack and deploy the application with
884
+
Now let's pack and deploy the application:
881
885
882
886
<div class="impl node">
883
887
@@ -928,7 +932,7 @@ The local setup is still runnable on basis of mock users as there is no IAS bind
928
932
929
933
Due to CAP's autoconfiguration, all CAP endpoints are [authenticated automatically](#model-auth) and expect valid XSUAA tokens.
930
934
931
-
Sending the test request
935
+
The following request as anonymous user without a token results in a `401 Unauthorized`:
0 commit comments