Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/intility/msal-keyvault-cache
A cache for @azure/msal-node that uses Azure KeyVault as a store.
https://github.com/intility/msal-keyvault-cache
azure azure-key-vault azure-keyvault cache key-vault keyvault keyvault-secrets msal msal-node token-cache
Last synced: 3 months ago
JSON representation
A cache for @azure/msal-node that uses Azure KeyVault as a store.
- Host: GitHub
- URL: https://github.com/intility/msal-keyvault-cache
- Owner: Intility
- License: mit
- Created: 2022-03-03T15:52:44.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-23T12:56:04.000Z (6 months ago)
- Last Synced: 2024-10-14T20:22:15.587Z (3 months ago)
- Topics: azure, azure-key-vault, azure-keyvault, cache, key-vault, keyvault, keyvault-secrets, msal, msal-node, token-cache
- Language: TypeScript
- Homepage:
- Size: 109 KB
- Stars: 11
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
@intility/msal-keyvault-cache
A cache for @azure/msal-node that uses Azure KeyVault as a store.## Usage
Install with
```
npm install @intility/msal-keyvault-cache
```Then, initialize the cache and use it in your client configuration
```js
import { PublicClientApplication } from "@azure/msal-node";
import keyVaultCache from "@intility/msal-keyvault-cache";let cachePlugin = keyVaultCache("https://YOUR_KEYVAULT_HERE.vault.azure.net/");
let publicClientConfig = {
auth: {
clientId: "CLIENT_ID",
authority: "https://login.microsoftonline.com/TENANT_ID",
},
cache: {
cachePlugin,
},
};let publicClientApplication = new PublicClientApplication(publicClientConfig);
```By default, it will authenticate to the KeyVault by using [`DefaultAzureCredential` from '@azure/identity'](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/README.md#defaultazurecredential). This means you can authenticate a number of ways. In CI you can use [environment variables](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/README.md#defaultazurecredential), and locally you can use the Azure CLI.
### Syntax
```js
let cachePlugin = keyVaultCache(keyVaultUrl);
let cachePlugin = keyVaultCache(keyVaultUrl, secretName);
let cachePlugin = keyVaultCache(keyVaultUrl, secretName, credential);
```### Parameters
#### `keyVaultUrl`
A JavaScript string containing the url to your Azure KeyVault.
#### `secretName` (optional)
- Default Value: `"msal-cache"`
A JavaScript string containing the name of the secret.
#### `credential` (optional)
- Default Value: `new DefaultAzureCredential()`
A [`Credential Class`](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/README.md#credential-classes) used to authenticate to the Azure KeyVault.
### Return value
A `cachePlugin` that can be used in a `@azure/msal-node` Client Configuration.