
S/4HANA Cloud APIs with ClientCertificateAuthentication |
![]() | Out of many hundreds and counting, SAPS4HANACloud APIs still only a subset of these APIs support the principal business user propagation with either OAuth2SAMLBearerAssertion and/or SAMLAssertion flow. Sometimes, within one same API family or communication scenario, there are APIs that support OAuth2SAMLBearerAssertion with business users and some other only support OAuth2SAMLBearerAssertion with a communication user. Still, the immense majority of APIs support x509 client certificate authentication (with regard to a SAPS4HANACloud communication user). |
Good to know:
Before we start.Pre-requisites:
Disclaimer:
|
-subj "/C=DE/ST=Gauteng/L=Heidelberg/O=SAP/OU=SAP/CN=QUOVADIS-X509.sap.biz"
$ openssl req -new -newkey rsa:4096 -nodes -out CSR.csr -keyout PrivateKey.key -subj "/C=DE/ST=Gauteng/L=Heidelberg/O=SAP/OU=SAP/CN=QUOVADIS-X509.sap.biz"
Generating a 4096 bit RSA private key
.........++
...................................++
writing new private key to 'PrivateKey.key'
-----
$ pbcopy < CSR.csr
..............sign the CSR with your CA....................
$ mv PrivateKey.key PrivateKey.key.original
$ openssl rsa -in PrivateKey.key.original -out PrivateKey.key
writing RSA key
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in PrivateKey.key -out pkcs8.pem
$ openssl pkcs7 -inform PEM -in Quovadis-x509-PKCS7.pem -print_certs -out Quovadis-x509-chain.pem
$ openssl pkcs12 -export -in Quovadis-x509-chain.pem -inkey pkcs8.pem -out S4HC.p12 -name QUOVADIS-X509.sap.biz
Enter Export Password:
Verifying - Enter Export Password:
cat S4HC.p12 | base64
On S/4HANA Cloud side have an existing or create a new communication user and upload a CA-signed x509 client certificate into it, as follows: ![]() |
Please notice this is the x509 certificate with the full chain of certificates! ![]() |
Please make sure the Authentication method is SSL Client Certificate ![]() |
Let's take an existing communication arrangement and the following API, namely API_MANAGE_WORKFORCE_TIMESHEET The API supports the x509 client certificate authentication. Thus let's make the communication arrangement use the SSL Client Certificate as the Authentication method, as depicted below: |
Upload S4HC.p12 keystore into APIM certificate keystore | ![]() |
Create API Provider based on the APIM certificate keystore from the previous step. | ![]() |
Configure the API Provider connection as follows:
| ![]() |
Let's use it this API Provider in the API Proxy | ![]() |
![]() | ![]() |
Postman settings. Pre-requisites: you have created your .p12 or .pfx keystore.
Good to know:
Subsequently, whenever you send a request to a configured host domain its client certificate is sent automatically by Postman. |
Postman console, Open the console in Postman tool and send a request to the S/4HANA Cloud service endpoint. |
Send a request: |
A case for a 3rd party applicationWhen a 3rd party client wants to talk to S/4HANA Cloud over mTLS with ODATA APIs all that is needed is to have a client application's https client agent use the key-store with the full chain x509 certificate and the private key.... For instance, this can be quite easily done in nodejs with axios and http agent. Or with the API Provider in API Management or using Postman. On the other hand, if one uses the destination service with the ClientCertificateAuthentication type of a destination, when the destination is called all it does is to return the certificate key-store as a base64-encoded string. This way one can easily base64-decode the key-store and extract the public and private keys to be passed to your application's http client agent. A case for SAP API Management as a framework to implement your extensions with S/4HANA CloudWhat is the real advantage of using APIM to implement your extensions with S/4HANA Cloud ? First of all there is no code to be written at all. Furthermore, one can group S/4HANA Cloud APIs (combining different authentication methods) into API Products and publish the API Products into the Developer portal. Then developers can create an application subscribing to the API Products and then get access to only those APIs which are grouped/associated within that API Products. |
Global PKI Certificate Management Web Enrolment is the SAP Certificate Authority service available internally at SAP for SAP employees only. |
![]() Select the matching CA and paste the CSR Submit the CSR to the Certificate Authority and retrieve a signed x509 certificate Select the PKCS7 format and resubmit the CSR |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |