diff --git a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/index.ts b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/index.ts index 0a172be632..592c318400 100644 --- a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/index.ts +++ b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/index.ts @@ -77,12 +77,16 @@ const credentialProvider: SimpleCredentialProvider = new SimpleCredentialProvide // Register the skills configuration class. const skillsConfig: SkillsConfiguration = new SkillsConfiguration(appsettings.botFrameworkSkills as IEnhancedBotFrameworkSkill[], appsettings.skillHostEndpoint); +let authenticationConfiguration = new AuthenticationConfiguration(); + // Register AuthConfiguration to enable custom claim validation. -const allowedCallers: string[] = [...skillsConfig.skills.values()].map(skill => skill.appId); -const authenticationConfiguration = new AuthenticationConfiguration( - undefined, - allowedCallersClaimsValidator(allowedCallers) -); +if (skillsConfig.skills.size > 0) { + const allowedCallers: string[] = [...skillsConfig.skills.values()].map(skill => skill.appId); + authenticationConfiguration = new AuthenticationConfiguration( + undefined, + allowedCallersClaimsValidator(allowedCallers) + ); +} // Configure telemetry const telemetryClient: BotTelemetryClient = getTelemetryClient(settings); diff --git a/templates/typescript/samples/sample-assistant/src/index.ts b/templates/typescript/samples/sample-assistant/src/index.ts index 0a172be632..592c318400 100644 --- a/templates/typescript/samples/sample-assistant/src/index.ts +++ b/templates/typescript/samples/sample-assistant/src/index.ts @@ -77,12 +77,16 @@ const credentialProvider: SimpleCredentialProvider = new SimpleCredentialProvide // Register the skills configuration class. const skillsConfig: SkillsConfiguration = new SkillsConfiguration(appsettings.botFrameworkSkills as IEnhancedBotFrameworkSkill[], appsettings.skillHostEndpoint); +let authenticationConfiguration = new AuthenticationConfiguration(); + // Register AuthConfiguration to enable custom claim validation. -const allowedCallers: string[] = [...skillsConfig.skills.values()].map(skill => skill.appId); -const authenticationConfiguration = new AuthenticationConfiguration( - undefined, - allowedCallersClaimsValidator(allowedCallers) -); +if (skillsConfig.skills.size > 0) { + const allowedCallers: string[] = [...skillsConfig.skills.values()].map(skill => skill.appId); + authenticationConfiguration = new AuthenticationConfiguration( + undefined, + allowedCallersClaimsValidator(allowedCallers) + ); +} // Configure telemetry const telemetryClient: BotTelemetryClient = getTelemetryClient(settings);