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", "welcomeFile": "app/bookshop/index.html",
"routes": [ "routes": [
{ {
"source": "^/app/(.*)$", "source": "^/app/(.*)$",
"target": "$1", "target": "$1",
"localDir": ".", "localDir": ".",
"cacheControl": "no-cache, no-store, must-revalidate" "cacheControl": "no-cache, no-store, must-revalidate"
}, },
{ {
"source": "^(.*)$", "source": "^(.*)$",
"target": "$1", "target": "$1",
"localDir": ".", "localDir": ".",
"cacheControl": "no-cache, no-store, must-revalidate" "cacheControl": "no-cache, no-store, must-revalidate"
}, },
{ {
"source": "^/admin/(.*)$", "source": "^/admin/(.*)$",
"target": "/admin/$1", "target": "/admin/$1",
"destination": "bookstore-api", "destination": "bookstore-api",
"csrfProtection": true "csrfProtection": true
}, },
{ {
"source": "^/browse/(.*)$", "source": "^/browse/(.*)$",
"target": "/browse/$1", "target": "/browse/$1",
"destination": "bookstore-api", "destination": "bookstore-api",
"csrfProtection": true "csrfProtection": true
}, },
{ {
"source": "^/user/(.*)$", "source": "^/user/(.*)$",
"target": "/user/$1", "target": "/user/$1",
"destination": "bookstore-api", "destination": "bookstore-api",
"csrfProtection": true "csrfProtection": true
}, },
{ {
"source": "^/odata/v4/orders/(.*)$", "source": "^/odata/v4/orders/(.*)$",
"target": "/odata/v4/orders/$1", "target": "/odata/v4/orders/$1",
"destination": "orders-api", "destination": "orders-api",
"csrfProtection": true "csrfProtection": true
}, },
{ {
"source": "^/reviews/(.*)$", "source": "^/reviews/(.*)$",
"target": "/reviews/$1", "target": "/reviews/$1",
"destination": "reviews-api", "destination": "reviews-api",
"csrfProtection": true "csrfProtection": true
} }
] ]
} }

View File

@@ -27,6 +27,7 @@ modules:
srv-url: ${default-url} srv-url: ${default-url}
requires: requires:
- name: samples-db - name: samples-db
- name: samples-auth
- name: samples-db-deployer - name: samples-db-deployer
type: hdb type: hdb
@@ -44,24 +45,25 @@ modules:
disk-quota: 256M disk-quota: 256M
memory: 256M memory: 256M
requires: requires:
- name: orders-api - name: orders-api
group: destinations group: destinations
properties: properties:
name: orders-api name: orders-api
url: ~{srv-url} url: ~{srv-url}
forwardAuthToken: true forwardAuthToken: true
- name: reviews-api - name: reviews-api
group: destinations group: destinations
properties: properties:
name: reviews-api name: reviews-api
url: ~{srv-url} url: ~{srv-url}
forwardAuthToken: true forwardAuthToken: true
- name: bookstore-api - name: bookstore-api
group: destinations group: destinations
properties: properties:
name: bookstore-api name: bookstore-api
url: ~{srv-url} url: ~{srv-url}
forwardAuthToken: true forwardAuthToken: true
- name: samples-auth
provides: provides:
- name: app-api - name: app-api
properties: properties:
@@ -74,3 +76,12 @@ resources:
parameters: parameters:
service: hana service: hana
service-plan: hdi-shared 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", "author": "daniel.hutzel@sap.com",
"dependencies": { "dependencies": {
"@sap/cds": ">=8", "@sap/cds": ">=8",
"@cap-js/hana": "^1" "@cap-js/hana": "^1",
"@sap/xssec": "^4"
}, },
"workspaces": [ "workspaces": [
"./bookshop", "./bookshop",
@@ -44,6 +45,11 @@
"cds": { "cds": {
"sql": { "sql": {
"native_hana_associations": false "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
}