Skip to content

Commit

Permalink
Support Workload Identity (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwatson484 authored Jul 4, 2024
1 parent c62cc88 commit 361ad33
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ npm install --save ffc-messaging

`useCredentialChain` - Boolean value for whether to authenticate connection with using Azure's credential chain. For example, set this to true if you wish to use [AAD Pod Identity](https://github.com/Azure/aad-pod-identity). If `false`, then `username` and `password` or `connectionString` are required.

`managedIdentityClientId` - Client Id of the Workload Identity. Required if using Workload Identity instead of Pod Identity or connection string.

`connectionString` - Azure Service Bus connection string. If provided, `username` and `password` are ignored.

`username` - Azure Service Bus Shared Access Key name for authentication. Not required if `useCredentialChain` is `true` or `connectionString` is provided.
Expand Down
6 changes: 5 additions & 1 deletion app/messaging/admin-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ class AdminClient {
}

getCredentials () {
return new DefaultAzureCredential()
if (this.config.managedIdentityClientId) {
return new DefaultAzureCredential({ managedIdentityClientId: this.config.managedIdentityClientId })
} else {
return new DefaultAzureCredential()
}
}

async getClient () {
Expand Down
6 changes: 5 additions & 1 deletion app/messaging/message-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ class MessageBase {
}

getCredentials () {
return new DefaultAzureCredential()
if (this.config.managedIdentityClientId) {
return new DefaultAzureCredential({ managedIdentityClientId: this.config.managedIdentityClientId })
} else {
return new DefaultAzureCredential()
}
}

async closeConnection () {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ffc-messaging",
"version": "2.9.1",
"description": "Messaging npm module for FFC services",
"version": "2.10.0",
"description": "Messaging npm module for FCP services",
"main": "index.js",
"repository": {
"type": "git",
Expand Down

0 comments on commit 361ad33

Please sign in to comment.