Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Workload Identity #31

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
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
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