@@ -44,7 +44,6 @@ import {
4444 type MSTeamsCardActionResponse ,
4545} from "./sdk.js" ;
4646import { createMSTeamsSsoTokenStoreFs } from "./sso-token-store.js" ;
47- import type { MSTeamsSsoDeps } from "./sso.js" ;
4847import { resolveMSTeamsCredentials } from "./token.js" ;
4948import { applyMSTeamsWebhookTimeouts } from "./webhook-timeouts.js" ;
5049
@@ -216,6 +215,10 @@ export async function monitorMSTeamsProvider(
216215 } ) ;
217216
218217 const configuredPath = ( msteamsCfg . webhook ?. path ?? "/api/messages" ) as `/${string } `;
218+ const ssoConnectionName =
219+ msteamsCfg . sso ?. enabled && msteamsCfg . sso . connectionName
220+ ? msteamsCfg . sso . connectionName
221+ : undefined ;
219222
220223 // Lazy-load the SDK and create the App with ExpressAdapter. The SDK
221224 // registers POST /api/messages (or configured path) and handles JWT
@@ -224,9 +227,7 @@ export async function monitorMSTeamsProvider(
224227 ...resolveMSTeamsSdkCloudOptions ( msteamsCfg ) ,
225228 httpServerAdapter : await createMSTeamsExpressAdapter ( expressApp ) ,
226229 messagingEndpoint : configuredPath ,
227- ...( msteamsCfg . sso ?. enabled && msteamsCfg . sso . connectionName
228- ? { oauthDefaultConnectionName : msteamsCfg . sso . connectionName }
229- : { } ) ,
230+ ...( ssoConnectionName ? { oauthDefaultConnectionName : ssoConnectionName } : { } ) ,
230231 } ) ;
231232
232233 // Existing Azure Bot registrations may still point at the legacy
@@ -260,19 +261,15 @@ export async function monitorMSTeamsProvider(
260261 // Build a token provider adapter for Graph API operations
261262 const tokenProvider = createMSTeamsTokenProvider ( app ) ;
262263
263- // Build SSO deps when the operator has opted in and a connection name
264- // is configured. Leaving `sso` undefined matches the pre-SSO behavior
265- // (the plugin will still ack signin invokes, but will not attempt a
266- // Bot Framework token exchange or persist anything).
267- let ssoDeps : MSTeamsSsoDeps | undefined ;
268- if ( msteamsCfg . sso ?. enabled && msteamsCfg . sso . connectionName ) {
269- ssoDeps = {
270- tokenProvider,
271- tokenStore : createMSTeamsSsoTokenStoreFs ( ) ,
272- connectionName : msteamsCfg . sso . connectionName ,
273- } ;
264+ const ssoDeps = ssoConnectionName
265+ ? {
266+ tokenStore : createMSTeamsSsoTokenStoreFs ( ) ,
267+ connectionName : ssoConnectionName ,
268+ }
269+ : undefined ;
270+ if ( ssoDeps ) {
274271 log . debug ?.( "msteams sso enabled" , {
275- connectionName : msteamsCfg . sso . connectionName ,
272+ connectionName : ssoDeps . connectionName ,
276273 } ) ;
277274 }
278275
@@ -291,7 +288,6 @@ export async function monitorMSTeamsProvider(
291288 conversationStore,
292289 pollStore,
293290 log,
294- sso : ssoDeps ,
295291 } ;
296292 registerMSTeamsHandlers ( handler , handlerDeps ) ;
297293
0 commit comments