diff --git a/event-mesh.json b/event-mesh.json new file mode 100644 index 00000000..964f3b44 --- /dev/null +++ b/event-mesh.json @@ -0,0 +1,31 @@ +{ + "emname": "samples-emname", + "version": "1.1.0", + "namespace": "default/samples/1", + "options": { + "management": true, + "messagingrest": true, + "messaging": true + }, + "rules": { + "topicRules": { + "publishFilter": [ + "${namespace}/*" + ], + "subscribeFilter": [ + "*" + ] + }, + "queueRules": { + "publishFilter": [ + "${namespace}/*" + ], + "subscribeFilter": [ + "${namespace}/*" + ] + } + }, + "authorities": [ + "$ACCEPT_GRANTED_AUTHORITIES" + ] +} diff --git a/mta.yaml b/mta.yaml index 3902f477..b76eeae5 100644 --- a/mta.yaml +++ b/mta.yaml @@ -28,6 +28,7 @@ modules: requires: - name: samples-db - name: samples-auth + - name: samples-messaging - name: samples-db-deployer type: hdb @@ -85,3 +86,9 @@ resources: config: xsappname: samples-${org}-${space} tenant-mode: dedicated + - name: samples-messaging + type: org.cloudfoundry.managed-service + parameters: + service: enterprise-messaging + service-plan: default + path: ./event-mesh.json diff --git a/package.json b/package.json index ab37a597..447ad1c1 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,9 @@ "requires": { "[production]": { "auth": "xsuaa" + }, + "messaging": { + "kind": "enterprise-messaging" } } } diff --git a/xs-security.json b/xs-security.json index ca8b592a..4e0bd285 100644 --- a/xs-security.json +++ b/xs-security.json @@ -1,19 +1,34 @@ { "scopes": [ { - "name": "$XSAPPNAME.admin", + "name": "$XSAPPNAME.admin", "description": "admin" + }, + { + "name": "$XSAPPNAME.emcallback", + "description": "Enterprise-Messaging Callback Access", + "grant-as-authority-to-apps": [ + "$XSSERVICENAME(samples-messaging)" + ] + }, + { + "name": "$XSAPPNAME.emmanagement", + "description": "Enterprise-Messaging Management Access" } ], "attributes": [], "role-templates": [ { - "name": "admin", - "scope-references": [ + "name": "admin", + "scope-references": [ "$XSAPPNAME.admin" - ], + ], "description": "cap samples multi-service shared-db" } ], - "authorities-inheritance": false + "authorities-inheritance": false, + "authorities": [ + "$XSAPPNAME.emmanagement", + "$XSAPPNAME.mtcallback" + ] }