Skip to Content
0
Aug 19, 2021 at 10:48 AM

Configure BTP Job Scheduler with SAP CAP XSUAA service

885 Views Last edit Aug 19, 2021 at 10:53 AM 3 rev

Hi,

We have CAP Odata service with authorization enabled via XSUAA.

When we tried to scheduled job we are getting 401 un authorized error.

Followed below but still no luck.

https://help.sap.com/doc/234ab5b017b14bfa9d96152c5d9335e7/Cloud/en-US/jobscheduler.pdf#page=74&zoom=100,0,0

https://blogs.sap.com/2020/02/19/using-job-scheduler-in-sap-cloud-platform-3-enable-oauth-authorization/

1.We have a secure CAP Project with an XSUAA instance.

service CatalogService @(requires: ['system-user','authenticated-user']){

// service CatalogService{

function SendEmail() returnsBoolean;

}

PS: CAP Service is working fine in POSTMAN via Oauth 2 Client Credentials.

2.XS-Security.json

{

"xsappname": "TEST",

"tenant-mode": "dedicated",

"description": "Security profile of called application",

"scopes": [

{

"name": "$XSAPPNAME.JOBSCHEDULER",

"description": "UAA",

"grant-as-authority-to-apps": ["$XSSERVICENAME(js1)"]

}

],

"role-templates": [

{

"name": "Token_Exchange",

"description": "UAA",

"scope-references": [

"$XSAPPNAME.JOBSCHEDULER"

]

}

]

}

3.MTA.YAML:

- name: uaa_TEST

type: org.cloudfoundry.managed-service

parameters:

path: ./xs-security.json

service: xsuaa

service-name: TEST-xsuaa-service

service-plan: application

- name: cross-container-service-1

type: org.cloudfoundry.existing-service

parameters:

service-name: grant-service

properties:

the-service-name: '${service-name}'

- name: js1

type: com.sap.xs.job-scheduler

parameters:

service: jobscheduler

service-name: js1

service-plan: standard

path: ./xs-job.json

4.XS-Job.json

{

"enable-xsuaa-support": true

}

5.Error in Job Scheduler

We have tried set the property, creation of instance with yaml and also with CLI Commands.

CLI Commands as follows:

cf set-env TEST-srv SAP_JWT_TRUST_ACL "[{"clientid":"*","identityzone":"*"}]"

cf create-service jobscheduler standard js1 -c '{"enable-xsuaa-support": true}'

cf bind-service TEST-srv js1

cf restage TEST-srv

cf env TEST-srv

I have already seen blog but no luck. I am not sure what i am missing here.

Any leads would be greatly appreciated

https://answers.sap.com/questions/13319907/sap-btp-job-scheduling-service-consume-secured-cap.html