
{
"xsappname": "cfdestination",
"tenant-mode": "shared",
"description": "Security profile of cfdestination app",
"scopes": [{
"name": "$XSAPPNAME.Callback",
"description": "With this scope set, the callbacks for tenant onboarding, offboarding and getDependencies can be called.",
"grant-as-authority-to-apps": [
"$XSAPPNAME(application,sap-provisioning,tenant-onboarding)"
]
},
{
"name": "$XSAPPNAME.read",
"description": "Read Scope"
},
{
"name": "uaa.user",
"description": "uaa.user"
}
],
"role-templates": [
{
"name":"MultitenancyCallbackRoleTemplate",
"description":"Call callback-services of applications",
"scope-references":[
"$XSAPPNAME.Callback"
]
},
{
"name": "Viewer",
"description": "Viewer Role Template",
"scope-references": [
"$XSAPPNAME.read",
"uaa.user"
]
}
],
"role-collections": [
{
"name": "MyDestinationApplicationViewer",
"description": "My Destination Application Viewer",
"role-template-references": [
"$XSAPPNAME.Viewer",
"$XSAPPNAME.MultitenancyCallbackRoleTemplate"
]
}
]
}
router.get('/callback/v1.0/dependencies', dependencyCallbackRoute);
router.put('/callback/v1.0/tenants/*', subscribeTenantRoute);
router.delete('/callback/v1.0/tenants/*', unsubscribeTenantRoute);
export async function dependencyCallbackRoute(req: Request, res: Response) {
var dest = xsenv.getServices({ destination: { tag: 'destination' } }).destination;
var xsappname = dest.xsappname;
res.status(200).json([{'appId': xsappname, 'appName': 'destination'}]);
}
export async function subscribeTenantRoute(req: Request, res: Response) {
var consumerSubdomain = req.params["0"];
var tenantAppURL = "https:\/\/" + consumerSubdomain + "-cfdestinationui.cfapps.eu10.hana.ondemand.com";
res.status(200).send(tenantAppURL);
}
export async function unsubscribeTenantRoute(req: Request, res: Response) {
res.status(200);
}
import { getDestination, DestinationOptions, DestinationSelectionStrategies } from '@sap-cloud-sdk/core';
router.get("/api/cloudfoundry/destinations", getCFDestinationsRoute);
let options: DestinationOptions = {}
export async function getCFDestinationsRoute(req: Request, res: Response) {
var paramdestination = req.query.destination;
options.selectionStrategy = DestinationSelectionStrategies.subscriberFirst;
options.userJwt = req.authInfo.getTokenInfo().getTokenValue();
var destination = await getDestination(paramdestination, options);
if (req.authInfo !== undefined && req.authInfo.checkLocalScope("read")) {
res.status(200).send(destination.originalProperties);
} else {
res.type("text/plain").status(401).send(`ERROR: Not Authorized. Missing Necessary scope`)
}
}
{
"name": "cfdestinationui",
"version": "1.0.0",
"description": "UI Module for Destination Application",
"devDependencies": {
"@sap/grunt-sapui5module-bestpractice-build": "^0.0.14"
},
"dependencies": {
"@sap/approuter": "2.7.1"
},
"scripts": {
"start": "node node_modules/@sap/approuter/approuter.js"
}
}
{
"welcomeFile": "/cfdestinationui/index.html",
"authenticationMethod": "route",
"logout": {
"logoutEndpoint": "/logout"
},
"routes": [{
"source": "^/cfdestinationui/(.*)$",
"target": "$1",
"localDir": "webapp"
}, {
"source": "^/cfdestinationbackend/(.*)$",
"target": "$1",
"csrfProtection": true,
"authenticationType": "xsuaa",
"destination": "cfdestinationbackend_api"
}
]
}
ID: cfdestinationapp
_schema-version: '2.1'
description: A multi-tenant enabled app for cf destination
version: 1.0.0
modules:
- name: cfdestinationbackend
type: nodejs
path: cfdestinationbackend
parameters:
disk-quota: 512M
memory: 512M
provides:
- name: cfdestinationbackend_api
properties:
backend_app_url: '${default-url}'
requires:
- name: cfdestination-uaa
- name: cfdestination-destination
properties:
SAP_JWT_TRUST_ACL:
- clientid: "*"
identityzone: "*"
- name: cfdestinationui
type: html5
path: cfdestinationui
parameters:
disk-quota: 512M
memory: 512M
build-parameters:
builder: grunt
requires:
- name: cfdestination-uaa
- name: cfdestinationbackend_api
group: destinations
properties:
name: cfdestinationbackend_api
url: '~{backend_app_url}'
forwardAuthToken: true
properties:
TENANT_HOST_PATTERN: "^(.*)-cfdestinationui.cfapps.eu10.hana.ondemand.com"
resources:
- name: cfdestination-uaa
parameters:
path: ./xs-security.json
service-plan: application
type: com.sap.xs.uaa
- name: cfdestination-destination
type: org.cloudfoundry.managed-service
parameters:
service: destination
service-plan: lite
{
"appId": "cfdestination!t50911",
"displayName": "CF Destination App",
"description": "App to Demo CF Destination",
"category": "Demo Provider",
"appUrls": {
"onSubscription": "https://13fa8802trial-dev-cfdestinationbackend.cfapps.eu10.hana.ondemand.com/callback/v1.0/tenants/{tenantId}",
"getDependencies": "https://13fa8802trial-dev-cfdestinationbackend.cfapps.eu10.hana.ondemand.com/callback/v1.0/dependencies"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
7 | |
7 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 | |
3 |