From d368166fef7db1b3ce1d869f05cf397cb06da09d Mon Sep 17 00:00:00 2001 From: CeciliaAvila Date: Fri, 19 Jan 2024 16:46:44 -0300 Subject: [PATCH 1/2] Add scope post-fix in managedIdentityAuthenticator. --- .../src/auth/managedIdentityAuthenticator.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/botframework-connector/src/auth/managedIdentityAuthenticator.ts b/libraries/botframework-connector/src/auth/managedIdentityAuthenticator.ts index ae2ae8df0a..d2ee95b333 100644 --- a/libraries/botframework-connector/src/auth/managedIdentityAuthenticator.ts +++ b/libraries/botframework-connector/src/auth/managedIdentityAuthenticator.ts @@ -30,6 +30,11 @@ export class ManagedIdentityAuthenticator { ok(resource?.trim(), 'ManagedIdentityAuthenticator.constructor(): missing resource.'); ok(tokenProviderFactory, 'ManagedIdentityAuthenticator.constructor(): missing tokenProviderFactory.'); + const scopePostfix = '/.default'; + if (!resource.endsWith(scopePostfix)) { + resource = `${resource}${scopePostfix}`; + } + this.resource = resource; this.tokenProvider = tokenProviderFactory.createAzureServiceTokenProvider(appId); } From 8a1c544a542496994b76f6b57a0302c72c8da06f Mon Sep 17 00:00:00 2001 From: CeciliaAvila Date: Fri, 19 Jan 2024 17:19:19 -0300 Subject: [PATCH 2/2] Fix unit test --- .../tests/auth/managedIdentityAuthenticator.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/botframework-connector/tests/auth/managedIdentityAuthenticator.test.js b/libraries/botframework-connector/tests/auth/managedIdentityAuthenticator.test.js index 89d39440c2..2236e9c625 100644 --- a/libraries/botframework-connector/tests/auth/managedIdentityAuthenticator.test.js +++ b/libraries/botframework-connector/tests/auth/managedIdentityAuthenticator.test.js @@ -6,7 +6,7 @@ const sinon = require('sinon'); const { JwtTokenProviderFactory, ManagedIdentityAuthenticator } = require('../../lib'); const testAppId = 'foo'; -const testAudience = 'bar'; +const testAudience = 'bar/.default'; const authResult = { token: '123', expiresOnTimestamp: 3000,