Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions docs/Authorization/AuthorizationBundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,23 @@ const ams = AuthorizationManagementService
```

```js [Node.js (CAP)]
// server.js
const cds = require('@sap/cds');
const { amsCapPluginRuntime } = require("@sap/ams");

// Update the credentials of the AMS CAP plugin runtime
// with the certificate information.
// cert and key must be PEM-encoded strings
amsCapPluginRuntime.credentials = {
...amsCapPluginRuntime.credentials,
cert,
key
}
// Extend the AMS CAP plugin runtime credentials with the provided certificate/key.
cds.on('served', async () => {
// assuming cert and key are PEM-encoded strings
amsCapPluginRuntime.credentials.certificate = cert;
amsCapPluginRuntime.credentials.key = key;
});

// If certificate/key change during runtime, update the properties inside the credentials object again.
someCredentialsWatcher.on('change', (newCert, newKey) => {
// assuming newCert and newKey are PEM-encoded strings
amsCapPluginRuntime.credentials.certificate = newCert;
amsCapPluginRuntime.credentials.key = newKey;
});
```

```java [Java]
Expand Down
Loading