File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,16 +101,23 @@ const ams = AuthorizationManagementService
101101```
102102
103103``` js [Node.js (CAP)]
104+ // server.js
105+ const cds = require (' @sap/cds' );
104106const { amsCapPluginRuntime } = require (" @sap/ams" );
105107
106- // Update the credentials of the AMS CAP plugin runtime
107- // with the certificate information.
108- // cert and key must be PEM-encoded strings
109- amsCapPluginRuntime .credentials = {
110- ... amsCapPluginRuntime .credentials ,
111- cert,
112- key
113- }
108+ // Extend the AMS CAP plugin runtime credentials with the provided certificate/key.
109+ cds .on (' served' , async () => {
110+ // assuming cert and key are PEM-encoded strings
111+ amsCapPluginRuntime .credentials .certificate = cert;
112+ amsCapPluginRuntime .credentials .key = key;
113+ });
114+
115+ // If certificate/key change during runtime, update the properties inside the credentials object again.
116+ someCredentialsWatcher .on (' change' , (newCert , newKey ) => {
117+ // assuming newCert and newKey are PEM-encoded strings
118+ amsCapPluginRuntime .credentials .certificate = newCert;
119+ amsCapPluginRuntime .credentials .key = newKey;
120+ });
114121```
115122
116123``` java [Java]
You can’t perform that action at this time.
0 commit comments