Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration needed to use IAS and SMS #382

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions app/xs-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,66 +7,66 @@
"cacheControl": "no-cache, no-store, must-revalidate",
"target": "$1",
"localDir": "./",
"authenticationType": "xsuaa"
"authenticationType": "ias"
},
{
"source": "^/appconfig/(.*)$",
"localDir": "./",
"authenticationType": "xsuaa"
"authenticationType": "ias"
},
{
"source": "^/browse/webapp/(.*)$",
"localDir": "./",
"authenticationType": "xsuaa"
"authenticationType": "ias"
},
{
"source": "^/admin/webapp/(.*)$",
"localDir": "./",
"authenticationType": "xsuaa"
"authenticationType": "ias"
},
{
"source": "^/orders/webapp/(.*)$",
"localDir": "./",
"authenticationType": "xsuaa"
"authenticationType": "ias"
},
{
"source": "^/reviews/webapp/(.*)$",
"localDir": "./",
"authenticationType": "xsuaa"
"authenticationType": "ias"
},
{
"source": "^/notes/webapp/(.*)$",
"localDir": "./",
"authenticationType": "xsuaa"
"authenticationType": "ias"
},
{
"source": "^/addresses/webapp/(.*)$",
"localDir": "./",
"authenticationType": "xsuaa"
"authenticationType": "ias"
},
{
"source": "^/vue/(.*)$",
"localDir": "./",
"authenticationType": "xsuaa"
"authenticationType": "ias"
},
{
"source": "^/api/admin/(.*)",
"authenticationType": "xsuaa",
"authenticationType": "ias",
"destination": "backend"
},
{
"source": "^/api/browse/(.*)",
"authenticationType": "xsuaa",
"authenticationType": "ias",
"destination": "backend"
},
{
"source": "^/api/review/(.*)",
"authenticationType": "xsuaa",
"authenticationType": "ias",
"destination": "backend"
},
{
"source": "^/api/notes/(.*)",
"authenticationType": "xsuaa",
"authenticationType": "ias",
"destination": "backend"
},
{
Expand Down
147 changes: 91 additions & 56 deletions mta-multi-tenant.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other branches like for messaging, we kept the mta-multi-tenant.yaml and added a separate one mta-multi-tenant-messaging.yaml. Should we stick to that pattern?

Copy link
Contributor

@BraunMatthias BraunMatthias Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dedicated mta files would be the preferred solution to demonstrate different flavours. I'd vote for mta-multi-tenant-ias-ams.yaml. We should also find a way to make this as a base for integ tests.

Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
_schema-version: '2.1'
ID: bookshop-mt
ID: bookshop-mt-ias
version: 1.0.0
description: "Multitenant Bookshop CAP Java Project with UI"
parameters:
enable-parallel-deployments: true
modules:
# --------------------- SERVER MODULE ------------------------
- name: bookshop-mt-srv
# ------------------------------------------------------------
# --------------------- SERVER MODULE ------------------------
- name: bookshop-mt-ias-srv
# ------------------------------------------------------------
type: java
path: srv
parameters:
memory: 1024M
disk-quota: 512M
buildpack: sap_java_buildpack_jakarta
routes:
- route: '${default-url}'
- route: '${default-host}.cert.${default-domain}'
properties:
SPRING_PROFILES_ACTIVE: cloud,sandbox
CDS_MULTITENANCY_APPUI_TENANTSEPARATOR: "-"
Expand All @@ -25,9 +28,16 @@ modules:
- mvn clean package -DskipTests=true
build-result: target/*-exec.jar
requires:
- name: bookshop-mt-service-manager
- name: bookshop-mt-uaa
- name: bookshop-mt-saas-registry
- name: bookshop-service-manager
- name: bookshop-sms
- name: bookshop-identity
parameters:
config:
credential-type: "X509_GENERATED"
key-length: 2048
validity: 30
validity-type: "DAYS"
app-identifier: "microservice1"
- name: mtx-api
properties:
CDS_MULTITENANCY_SIDECAR_URL: ~{mtx-url}
Expand All @@ -39,9 +49,10 @@ modules:
- name: srv-api
properties:
srv-url: '${default-url}'
# --------------------- SIDECAR MODULE -----------------------
- name: bookshop-mt-sidecar
# ------------------------------------------------------------
srv-cert-url: '${protocol}://${default-host}.cert.${default-domain}'
# --------------------- SIDECAR MODULE -----------------------
- name: bookshop-mt-ias-sidecar
# ------------------------------------------------------------
type: nodejs
path: mtx/sidecar
parameters:
Expand All @@ -53,83 +64,107 @@ modules:
commands:
- npm run build
requires:
- name: bookshop-mt-srv
- name: bookshop-mt-ias-srv
requires:
- name: bookshop-mt-service-manager
- name: bookshop-mt-uaa
- name: bookshop-service-manager
- name: bookshop-identity
parameters:
config:
credential-type: "X509_GENERATED"
key-length: 2048
validity: 30
validity-type: "DAYS"
app-identifier: "microservice1"
- name: cf-logging
provides:
- name: mtx-api
properties:
mtx-url: ${default-url}
# --------------------- APPROUTER MODULE ---------------------
- name: bookshop-mt-app
# ------------------------------------------------------------
# --------------------- APPROUTER MODULE ---------------------
- name: bookshop-mt-ias-app
# ------------------------------------------------------------
type: approuter.nodejs
path: app
parameters:
memory: 256M
disk-quota: 512M
keep-existing-routes: true
properties:
TENANT_HOST_PATTERN: ^(.*)-${default-uri} # testing only, use custom domain with wildcard for production
TENANT_HOST_PATTERN: ^(.*)-${default-host}.${default-domain} # testing only, use custom domain with wildcard for production
requires:
- name: srv-api
group: destinations
properties:
name: backend
url: ~{srv-url}
forwardAuthToken: true
strictSSL: true
- name: bookshop-mt-uaa
- name: srv-api
group: destinations
properties:
name: backend
url: ~{srv-cert-url}
forwardAuthCertificates: true
forwardAuthToken: true
strictSSL: true
- name: bookshop-identity
parameters:
config:
credential-type: "X509_GENERATED"
key-length: 2048
validity: 30
validity-type: "DAYS"
app-identifier: "microservice1"
- name: bookshop-sms
provides:
- name: app-api
properties:
app-url: '${default-url}'
app-domain: '${domain}'
app-domain: '${default-domain}'
# --------------------- RESOURCES ---------------------
resources:
# -----------------------------------------------------
- name: bookshop-mt-uaa
type: org.cloudfoundry.managed-service
parameters:
service: xsuaa
service-plan: application
path: ./xs-security-mt.json
StefanHenke marked this conversation as resolved.
Show resolved Hide resolved
config: # override xsappname as it needs to be unique
xsappname: bookshop-mt-${org}-${space}
oauth2-configuration:
redirect-uris:
- https://*.~{app-api/app-domain}/**
requires:
- name: app-api
- name: bookshop-mt-service-manager
# -----------------------------------------------------
- name: bookshop-service-manager
StefanHenke marked this conversation as resolved.
Show resolved Hide resolved
type: org.cloudfoundry.managed-service
parameters:
service: service-manager
service-plan: container
- name: bookshop-mt-saas-registry
- name: bookshop-identity
type: org.cloudfoundry.managed-service
parameters:
service: saas-registry
service: identity
service-plan: application
config:
appName: bookshop-mt-${org}-${space} # this is the text on the tile
xsappname: bookshop-mt-${org}-${space} # this is the value from xsuaa.parameters.config.xsappname
appUrls:
getDependencies: ~{srv-api/srv-url}/mt/v1.0/subscriptions/dependencies
onSubscription: ~{srv-api/srv-url}/mt/v1.0/subscriptions/tenants/{tenantId}
onSubscriptionAsync: true
onUnSubscriptionAsync: true
onUpdateDependenciesAsync: true
callbackTimeoutMillis: 3600000
displayName: bookshop-java
description: A simple CAP Java project.
category: 'Category'
authorization:
StefanHenke marked this conversation as resolved.
Show resolved Hide resolved
enabled: true
value_help_url: "https://vhp-srv-develop.cert.cfapps.sap.hana.ondemand.com/odata/v4/ExampleValueHelpService/"
oauth2-configuration:
redirect-uris: [
"https://*.cfapps.sap.hana.ondemand.com/**",
"https://*.internal.cfapps.sap.hana.ondemand.com/node/signin-oidc/*",
"http://localhost:5000/login/callback?authType=ias"
]
xsuaa-cross-consumption: true
display-name: bookshop-identity
multi-tenant: true
- name: bookshop-sms
type: org.cloudfoundry.managed-service
parameters:
service: subscription-manager
service-plan: provider
config:
iasServiceInstanceName: bookshop-identity
applicationType: application
appName: bookshop-mt-ias
appCallbacks:
dependenciesCallbacks:
url: ~{srv-api/srv-cert-url}/mt/sms/subscriptions/tenants/{app_tid}/dependencies
subscriptionCallbacks:
url: ~{srv-api/srv-cert-url}/mt/sms/subscriptions/tenants/{app_tid}
subscribeEnable: true
unSubscribeEnable: true
timeoutInMillis: 60000
displayName: bookshop-mt-ias
description: "Bookshop Identity"
category: "Application Development and Automation"
requires:
- name: srv-api
processed-after: [ bookshop-identity ]
- name: cf-logging
type: org.cloudfoundry.managed-service
parameters:
service: application-logs
service-plan: lite
service-plan: lite
3 changes: 3 additions & 0 deletions mtx/sidecar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"profiles": ["mtx-sidecar", "java"],
"[development]": {
"requires": { "auth": "dummy" }
},
"requires": {
"auth": "ias"
}
},
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions srv/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ cds:
kind: enterprise-messaging
format: cloudevents
subscribe-prefix: sap/S4HANAOD/java/ce/
security.authorization.deep.enabled: true

---
spring:
Expand Down
Loading