cds add xsuaa --for production

This commit is contained in:
Johannes Vogt
2025-03-21 16:52:51 +01:00
parent dca837e595
commit 39335c8c9b
4 changed files with 72 additions and 49 deletions

View File

@@ -2,46 +2,46 @@
"welcomeFile": "app/bookshop/index.html",
"routes": [
{
"source": "^/app/(.*)$",
"target": "$1",
"localDir": ".",
"source": "^/app/(.*)$",
"target": "$1",
"localDir": ".",
"cacheControl": "no-cache, no-store, must-revalidate"
},
{
"source": "^(.*)$",
"target": "$1",
"localDir": ".",
"source": "^(.*)$",
"target": "$1",
"localDir": ".",
"cacheControl": "no-cache, no-store, must-revalidate"
},
{
"source": "^/admin/(.*)$",
"target": "/admin/$1",
"destination": "bookstore-api",
"source": "^/admin/(.*)$",
"target": "/admin/$1",
"destination": "bookstore-api",
"csrfProtection": true
},
{
"source": "^/browse/(.*)$",
"target": "/browse/$1",
"destination": "bookstore-api",
},
{
"source": "^/browse/(.*)$",
"target": "/browse/$1",
"destination": "bookstore-api",
"csrfProtection": true
},
{
"source": "^/user/(.*)$",
"target": "/user/$1",
"destination": "bookstore-api",
},
{
"source": "^/user/(.*)$",
"target": "/user/$1",
"destination": "bookstore-api",
"csrfProtection": true
},
{
"source": "^/odata/v4/orders/(.*)$",
"target": "/odata/v4/orders/$1",
"destination": "orders-api",
},
{
"source": "^/odata/v4/orders/(.*)$",
"target": "/odata/v4/orders/$1",
"destination": "orders-api",
"csrfProtection": true
},
{
"source": "^/reviews/(.*)$",
"target": "/reviews/$1",
"destination": "reviews-api",
},
{
"source": "^/reviews/(.*)$",
"target": "/reviews/$1",
"destination": "reviews-api",
"csrfProtection": true
}
}
]
}

View File

@@ -27,6 +27,7 @@ modules:
srv-url: ${default-url}
requires:
- name: samples-db
- name: samples-auth
- name: samples-db-deployer
type: hdb
@@ -44,24 +45,25 @@ modules:
disk-quota: 256M
memory: 256M
requires:
- name: orders-api
group: destinations
properties:
name: orders-api
url: ~{srv-url}
forwardAuthToken: true
- name: reviews-api
group: destinations
properties:
name: reviews-api
url: ~{srv-url}
forwardAuthToken: true
- name: bookstore-api
group: destinations
properties:
name: bookstore-api
url: ~{srv-url}
forwardAuthToken: true
- name: orders-api
group: destinations
properties:
name: orders-api
url: ~{srv-url}
forwardAuthToken: true
- name: reviews-api
group: destinations
properties:
name: reviews-api
url: ~{srv-url}
forwardAuthToken: true
- name: bookstore-api
group: destinations
properties:
name: bookstore-api
url: ~{srv-url}
forwardAuthToken: true
- name: samples-auth
provides:
- name: app-api
properties:
@@ -74,3 +76,12 @@ resources:
parameters:
service: hana
service-plan: hdi-shared
- name: samples-auth
type: org.cloudfoundry.managed-service
parameters:
service: xsuaa
service-plan: application
path: ./xs-security.json
config:
xsappname: samples-${org}-${space}
tenant-mode: dedicated

View File

@@ -6,7 +6,8 @@
"author": "daniel.hutzel@sap.com",
"dependencies": {
"@sap/cds": ">=8",
"@cap-js/hana": "^1"
"@cap-js/hana": "^1",
"@sap/xssec": "^4"
},
"workspaces": [
"./bookshop",
@@ -44,6 +45,11 @@
"cds": {
"sql": {
"native_hana_associations": false
},
"requires": {
"[production]": {
"auth": "xsuaa"
}
}
}
}

6
xs-security.json Normal file
View File

@@ -0,0 +1,6 @@
{
"scopes": [],
"attributes": [],
"role-templates": [],
"authorities-inheritance": false
}