diff --git a/templates/csharp/Skill/Skill/Adapters/DefaultAdapter.cs b/templates/csharp/Skill/Skill/Adapters/DefaultAdapter.cs
index a2302ef306..6b01e76141 100644
--- a/templates/csharp/Skill/Skill/Adapters/DefaultAdapter.cs
+++ b/templates/csharp/Skill/Skill/Adapters/DefaultAdapter.cs
@@ -53,7 +53,7 @@ public DefaultAdapter(
Use(new ShowTypingMiddleware());
Use(new SetLocaleMiddleware(settings.DefaultLocale ?? "en-us"));
Use(new EventDebuggerMiddleware());
- Use(new SetSpeakMiddleware());
+ Use(new SetSpeakMiddleware("en-US-JennyNeural", true));
}
private async Task HandleTurnErrorAsync(ITurnContext turnContext, Exception exception)
diff --git a/templates/csharp/Skill/Skill/Authentication/AllowedCallersClaimsValidator.cs b/templates/csharp/Skill/Skill/Authentication/AllowedCallersClaimsValidator.cs
deleted file mode 100644
index 5a1c43ac06..0000000000
--- a/templates/csharp/Skill/Skill/Authentication/AllowedCallersClaimsValidator.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-using System;
-using System.Collections.Generic;
-using System.Security.Claims;
-using System.Threading.Tasks;
-using Microsoft.Bot.Connector.Authentication;
-using Microsoft.Extensions.Configuration;
-
-namespace $safeprojectname$.Authentication
-{
- ///
- /// Sample claims validator that loads an allowed list from configuration
- /// and checks that requests are coming from allowed parent bots.
- ///
- public class AllowedCallersClaimsValidator : ClaimsValidator
- {
- private const string ConfigKey = "allowedCallers";
- private readonly List _allowedCallers;
-
- public AllowedCallersClaimsValidator(IConfiguration config)
- {
- if (config == null)
- {
- throw new ArgumentNullException(nameof(config));
- }
-
- // AllowedCallers is the setting in the appsettings.json file
- // that consists of the list of parent bot IDs that are allowed to access the skill.
- // To add a new parent bot, simply edit the AllowedCallers and add
- // the parent bot's Microsoft app ID to the list.
- // In this sample, we allow all callers if AllowedCallers contains an "*".
- var section = config.GetSection(ConfigKey);
- var appsList = section.Get();
- if (appsList == null)
- {
- throw new ArgumentNullException($"\"{ConfigKey}\" not found in configuration.");
- }
-
- _allowedCallers = new List(appsList);
- }
-
- public override Task ValidateClaimsAsync(IList claims)
- {
- // If _allowedCallers contains an "*", we allow all callers.
- if (SkillValidation.IsSkillClaim(claims) && !_allowedCallers.Contains("*"))
- {
- // Check that the appId claim in the skill request is in the list of callers configured for this bot.
- var appId = JwtTokenValidation.GetAppIdFromClaims(claims);
- if (!_allowedCallers.Contains(appId))
- {
- throw new UnauthorizedAccessException($"Received a request from a bot with an app ID of \"{appId}\". To enable requests from this caller, add the app ID to your configuration file.");
- }
- }
-
- return Task.CompletedTask;
- }
- }
-}
\ No newline at end of file
diff --git a/templates/csharp/Skill/Skill/Skill.csproj b/templates/csharp/Skill/Skill/Skill.csproj
index ffb7866ee3..0c8e2dbbf1 100644
--- a/templates/csharp/Skill/Skill/Skill.csproj
+++ b/templates/csharp/Skill/Skill/Skill.csproj
@@ -9,13 +9,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/templates/csharp/Skill/Skill/Startup.cs b/templates/csharp/Skill/Skill/Startup.cs
index b1ac26d030..0f2c82fc8d 100644
--- a/templates/csharp/Skill/Skill/Startup.cs
+++ b/templates/csharp/Skill/Skill/Startup.cs
@@ -21,7 +21,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using $safeprojectname$.Adapters;
-using $safeprojectname$.Authentication;
using $safeprojectname$.Bots;
using $safeprojectname$.Dialogs;
using $safeprojectname$.Services;
@@ -72,7 +71,10 @@ public void ConfigureServices(IServiceCollection services)
services.AddSingleton();
// Register AuthConfiguration to enable custom claim validation.
- services.AddSingleton(sp => new AuthenticationConfiguration { ClaimsValidator = new AllowedCallersClaimsValidator(sp.GetService()) });
+ services.AddSingleton(sp => new AuthenticationConfiguration
+ {
+ ClaimsValidator = new AllowedCallersClaimsValidator(sp.GetService().GetSection("allowedCallers").Get>())
+ });
// Configure configuration provider
services.AddSingleton();
diff --git a/templates/csharp/VA/VA/Adapters/DefaultAdapter.cs b/templates/csharp/VA/VA/Adapters/DefaultAdapter.cs
index 8ec5c0177d..8f2687c7f1 100644
--- a/templates/csharp/VA/VA/Adapters/DefaultAdapter.cs
+++ b/templates/csharp/VA/VA/Adapters/DefaultAdapter.cs
@@ -64,7 +64,7 @@ public DefaultAdapter(
Use(new ShowTypingMiddleware());
Use(new SetLocaleMiddleware(settings.DefaultLocale ?? "en-us"));
Use(new EventDebuggerMiddleware());
- Use(new SetSpeakMiddleware());
+ Use(new SetSpeakMiddleware("en-US-JennyNeural", true));
}
private async Task HandleTurnErrorAsync(ITurnContext turnContext, Exception exception)
diff --git a/templates/csharp/VA/VA/Authentication/AllowedCallersClaimsValidator.cs b/templates/csharp/VA/VA/Authentication/AllowedCallersClaimsValidator.cs
deleted file mode 100644
index ac55f69c41..0000000000
--- a/templates/csharp/VA/VA/Authentication/AllowedCallersClaimsValidator.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Claims;
-using System.Threading.Tasks;
-using Microsoft.Bot.Connector.Authentication;
-using Microsoft.Bot.Solutions.Skills;
-
-namespace $safeprojectname$.Authentication
-{
- ///
- /// Sample claims validator that loads an allowed list from configuration if present
- /// and checks that responses are coming from configured skills.
- ///
- public class AllowedCallersClaimsValidator : ClaimsValidator
- {
- private readonly List _allowedSkills;
-
- public AllowedCallersClaimsValidator(SkillsConfiguration skillsConfig)
- {
- if (skillsConfig == null)
- {
- throw new ArgumentNullException(nameof(skillsConfig));
- }
-
- // Load the appIds for the configured skills (we will only allow responses from skills we have configured).
- _allowedSkills = (from skill in skillsConfig.Skills.Values select skill.AppId).ToList();
- }
-
- public override Task ValidateClaimsAsync(IList claims)
- {
- if (SkillValidation.IsSkillClaim(claims))
- {
- // Check that the appId claim in the skill request is in the list of skills configured for this bot.
- var appId = JwtTokenValidation.GetAppIdFromClaims(claims);
- if (!_allowedSkills.Contains(appId))
- {
- throw new UnauthorizedAccessException($"Received a request from an application with an appID of \"{appId}\". To enable requests from this skill, add the skill to your configuration file.");
- }
- }
-
- return Task.CompletedTask;
- }
- }
-}
\ No newline at end of file
diff --git a/templates/csharp/VA/VA/Startup.cs b/templates/csharp/VA/VA/Startup.cs
index a2761c6d5e..f605ad1586 100644
--- a/templates/csharp/VA/VA/Startup.cs
+++ b/templates/csharp/VA/VA/Startup.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -24,7 +25,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using $safeprojectname$.Adapters;
-using $safeprojectname$.Authentication;
using $safeprojectname$.Bots;
using $safeprojectname$.Dialogs;
using $safeprojectname$.Services;
@@ -73,7 +73,8 @@ public void ConfigureServices(IServiceCollection services)
services.AddSingleton(skillsConfig);
// Register AuthConfiguration to enable custom claim validation.
- services.AddSingleton(sp => new AuthenticationConfiguration { ClaimsValidator = new AllowedCallersClaimsValidator(skillsConfig) });
+ var allowedCallers = (from skill in skillsConfig.Skills.Values select skill.AppId).ToList();
+ services.AddSingleton(sp => new AuthenticationConfiguration { ClaimsValidator = new AllowedCallersClaimsValidator(allowedCallers) });
// Configure telemetry
services.AddApplicationInsightsTelemetry();
diff --git a/templates/csharp/VA/VA/VA.csproj b/templates/csharp/VA/VA/VA.csproj
index 83846dc3c0..39c07e298b 100644
--- a/templates/csharp/VA/VA/VA.csproj
+++ b/templates/csharp/VA/VA/VA.csproj
@@ -14,14 +14,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/_package.json b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/_package.json
index 9509b96a02..669c98f653 100644
--- a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/_package.json
+++ b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/_package.json
@@ -21,15 +21,16 @@
"dependencies": {
"@microsoft/microsoft-graph-client": "^1.3.0",
"@microsoft/microsoft-graph-types": "^1.5.0",
- "botbuilder": "^4.9.2",
- "botbuilder-ai": "^4.9.2",
- "botbuilder-applicationinsights": "^4.9.2",
- "botbuilder-azure": "^4.9.2",
- "botbuilder-dialogs": "^4.9.2",
- "botbuilder-lg": "^4.9.2",
- "bot-solutions": "^1.0.0",
- "botframework-config": "^4.9.2",
- "botframework-connector": "^4.9.2",
+ "botbuilder": "^4.13.5",
+ "botbuilder-ai": "^4.13.5",
+ "botbuilder-applicationinsights": "^4.13.5",
+ "botbuilder-azure": "^4.13.5",
+ "botbuilder-azure-blobs": "^4.13.5-preview",
+ "botbuilder-dialogs": "^4.13.5",
+ "botbuilder-lg": "^4.13.5",
+ "bot-solutions": "^1.1.0",
+ "botframework-config": "^4.13.5-deprecated",
+ "botframework-connector": "^4.13.5",
"restify": "^8.5.1"
},
"devDependencies": {
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/adapters/defaultAdapter.ts b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/adapters/defaultAdapter.ts
index 9573c84a7f..74030bec23 100644
--- a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/adapters/defaultAdapter.ts
+++ b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/adapters/defaultAdapter.ts
@@ -8,18 +8,18 @@ import {
BotFrameworkAdapterSettings,
BotTelemetryClient,
ConversationState,
+ SetSpeakMiddleware,
ShowTypingMiddleware,
SkillHttpClient,
TranscriptLoggerMiddleware,
TranscriptStore,
TurnContext,
TelemetryException } from 'botbuilder';
-import { AzureBlobTranscriptStore } from 'botbuilder-azure';
+import { BlobsTranscriptStore } from 'botbuilder-azure-blobs';
import {
EventDebuggerMiddleware,
LocaleTemplateManager,
- SetLocaleMiddleware,
- SetSpeakMiddleware } from 'bot-solutions';
+ SetLocaleMiddleware } from 'bot-solutions';
import { TelemetryInitializerMiddleware } from 'botbuilder-applicationinsights';
import { IBotSettings } from '../services/botSettings.js';
import { ActivityEx, SkillsConfiguration } from 'bot-solutions/lib';
@@ -67,10 +67,7 @@ export class DefaultAdapter extends BotFrameworkAdapter {
throw new Error('There is no blobStorage value in appsettings file');
}
- const transcriptStore: TranscriptStore = new AzureBlobTranscriptStore({
- containerName: settings.blobStorage.container,
- storageAccountOrConnectionString: settings.blobStorage.connectionString
- });
+ const transcriptStore: TranscriptStore = new BlobsTranscriptStore(settings.blobStorage.connectionString, settings.blobStorage.container);
this.use(telemetryMiddleware);
@@ -80,7 +77,7 @@ export class DefaultAdapter extends BotFrameworkAdapter {
this.use(new ShowTypingMiddleware());
this.use(new SetLocaleMiddleware(settings.defaultLocale || 'en-us'));
this.use(new EventDebuggerMiddleware());
- this.use(new SetSpeakMiddleware());
+ this.use(new SetSpeakMiddleware('en-US-JennyNeural', true));
}
private async handleTurnError(turnContext: TurnContext, error: Error): Promise {
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/authentication/allowedCallersClaimsValidator.ts b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/authentication/allowedCallersClaimsValidator.ts
deleted file mode 100644
index 22336c44a6..0000000000
--- a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/authentication/allowedCallersClaimsValidator.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright(c) Microsoft Corporation.All rights reserved.
- * Licensed under the MIT License.
- */
-
-import { Claim, JwtTokenValidation, SkillValidation } from 'botframework-connector';
-import { SkillsConfiguration } from 'bot-solutions';
-
-/**
- * Sample claims validator that loads an allowed list from configuration if present and checks that responses are coming from configured skills.
- */
-export class AllowedCallersClaimsValidator {
- private readonly allowedSkills: string[];
-
- public constructor(skillsConfig: SkillsConfiguration) {
- if (skillsConfig === undefined) {
- throw new Error ('The value of skillsConfig is undefined');
- }
-
- // Load the appIds for the configured skills (we will only allow responses from skills we have configured).
- this.allowedSkills = [...skillsConfig.skills.values()].map(skill => skill.appId);
- }
-
- public async validateClaims(claims: Claim[]): Promise {
- if (SkillValidation.isSkillClaim(claims)) {
- // Check that the appId claim in the skill request is in the list of skills configured for this bot.
- const appId = JwtTokenValidation.getAppIdFromClaims(claims);
- if (!this.allowedSkills.includes(appId)) {
- throw new Error(`Received a request from a bot with an app ID of "${ appId }". To enable requests from this caller, add the app ID to your configuration file.`);
- }
- }
-
- return Promise.resolve();
- }
-}
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/bots/defaultActivityHandler.ts b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/bots/defaultActivityHandler.ts
index 75e36c3edb..af5cabdc43 100644
--- a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/bots/defaultActivityHandler.ts
+++ b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/bots/defaultActivityHandler.ts
@@ -7,7 +7,6 @@ import {
Activity,
ActivityTypes,
BotState,
- ChannelAccount,
Channels,
ConversationState,
SigninStateVerificationQuery,
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/dialogs/mainDialog.ts b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/dialogs/mainDialog.ts
index 17241866f5..6d5f602372 100644
--- a/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/dialogs/mainDialog.ts
+++ b/templates/typescript/generator-bot-virtualassistant/generators/app/templates/sample-assistant/src/dialogs/mainDialog.ts
@@ -403,7 +403,7 @@ export class MainDialog extends ComponentDialog {
return await stepContext.beginDialog(dialogId);
} else if (this.shouldBeginChitChatDialog(stepContext, dispatchIntent, dispatchScore)) {
DialogContextEx.suppressCompletionMessage(stepContext, true);
- const dialogId = this.registerLocalizedQnADialog('chitchat', stepContext.context, localizedServices)
+ const dialogId = this.registerLocalizedQnADialog('chitchat', stepContext.context, localizedServices);
return await stepContext.beginDialog(dialogId);
} else {
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 348c696e94..0a172be632 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
@@ -14,18 +14,19 @@ import {
UserState,
TelemetryLoggerMiddleware,
SkillHttpClient,
+ SkillConversationIdFactory,
BotFrameworkSkill } from 'botbuilder';
import { ApplicationInsightsTelemetryClient, ApplicationInsightsWebserverMiddleware } from 'botbuilder-applicationinsights';
-import { CosmosDbPartitionedStorage, CosmosDbPartitionedStorageOptions } from 'botbuilder-azure';
+import { CosmosDbPartitionedStorage } from 'botbuilder-azure';
import { Dialog, SkillDialog, SkillDialogOptions } from 'botbuilder-dialogs';
import {
CognitiveModelConfiguration,
+ CosmosDbPartitionedStorageOptions,
LocaleTemplateManager,
SwitchSkillDialog,
IEnhancedBotFrameworkSkill,
- SkillsConfiguration,
- SkillConversationIdFactory } from 'bot-solutions';
-import { SimpleCredentialProvider, AuthenticationConfiguration, Claim } from 'botframework-connector';
+ SkillsConfiguration } from 'bot-solutions';
+import { SimpleCredentialProvider, AuthenticationConfiguration, allowedCallersClaimsValidator } from 'botframework-connector';
import { join } from 'path';
import * as restify from 'restify';
import { DefaultAdapter } from './adapters/defaultAdapter';
@@ -39,7 +40,6 @@ import { IBotSettings } from './services/botSettings';
import { Activity } from 'botframework-schema';
import { TelemetryInitializerMiddleware } from 'botbuilder-applicationinsights';
import { IUserProfileState } from './models/userProfileState';
-import { AllowedCallersClaimsValidator } from './authentication/allowedCallersClaimsValidator';
import { ITokenExchangeConfig, TokenExchangeSkillHandler } from './tokenExchange';
function getTelemetryClient(settings: Partial): BotTelemetryClient {
@@ -78,10 +78,10 @@ const credentialProvider: SimpleCredentialProvider = new SimpleCredentialProvide
const skillsConfig: SkillsConfiguration = new SkillsConfiguration(appsettings.botFrameworkSkills as IEnhancedBotFrameworkSkill[], appsettings.skillHostEndpoint);
// Register AuthConfiguration to enable custom claim validation.
-const allowedCallersClaimsValidator: AllowedCallersClaimsValidator = new AllowedCallersClaimsValidator(skillsConfig);
+const allowedCallers: string[] = [...skillsConfig.skills.values()].map(skill => skill.appId);
const authenticationConfiguration = new AuthenticationConfiguration(
undefined,
- (claims: Claim[]) => allowedCallersClaimsValidator.validateClaims(claims)
+ allowedCallersClaimsValidator(allowedCallers)
);
// Configure telemetry
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/_package.json b/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/_package.json
index 17ec954e5c..157c77aaf7 100644
--- a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/_package.json
+++ b/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/_package.json
@@ -19,15 +19,16 @@
"test-coverage-ci": "nyc --reporter=cobertura mocha --reporter mocha-junit-reporter"
},
"dependencies": {
- "botbuilder": "^4.9.2",
- "botbuilder-ai": "^4.9.2",
- "botbuilder-applicationinsights": "^4.9.2",
- "botbuilder-azure": "^4.9.2",
- "botbuilder-dialogs": "^4.9.2",
- "botbuilder-lg": "^4.9.2",
- "bot-solutions": "^1.0.0",
- "botframework-config": "^4.9.2",
- "botframework-connector": "^4.9.2",
+ "botbuilder": "^4.13.5",
+ "botbuilder-ai": "^4.13.5",
+ "botbuilder-applicationinsights": "^4.13.5",
+ "botbuilder-azure": "^4.13.5",
+ "botbuilder-azure-blobs": "^4.13.5-preview",
+ "botbuilder-dialogs": "^4.13.5",
+ "botbuilder-lg": "^4.13.5",
+ "bot-solutions": "^1.1.0",
+ "botframework-config": "^4.13.5-deprecated",
+ "botframework-connector": "^4.13.5",
"dotenv": "^6.0.0",
"restify": "^8.5.1"
},
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/adapters/defaultAdapter.ts b/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/adapters/defaultAdapter.ts
index 765487fd13..630e37c5b4 100644
--- a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/adapters/defaultAdapter.ts
+++ b/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/adapters/defaultAdapter.ts
@@ -8,6 +8,7 @@ import {
BotFrameworkAdapterSettings,
BotTelemetryClient,
ConversationState,
+ SetSpeakMiddleware,
ShowTypingMiddleware,
TelemetryException,
TelemetryLoggerMiddleware,
@@ -17,11 +18,10 @@ import {
EventDebuggerMiddleware,
SetLocaleMiddleware,
LocaleTemplateManager,
- SetSpeakMiddleware,
ActivityEx } from 'bot-solutions';
import { IBotSettings } from '../services/botSettings';
import { TurnContextEx } from '../extensions/turnContextEx';
-import { AzureBlobTranscriptStore, BlobStorageSettings } from 'botbuilder-azure';
+import { BlobsTranscriptStore } from 'botbuilder-azure-blobs';
import { TelemetryInitializerMiddleware } from 'botbuilder-applicationinsights';
export class DefaultAdapter extends BotFrameworkAdapter {
@@ -65,13 +65,12 @@ export class DefaultAdapter extends BotFrameworkAdapter {
// Uncomment the following line for local development without Azure Storage
// this.use(new TranscriptLoggerMiddleware(new MemoryTranscriptStore()));
- const blobStorageSettings: BlobStorageSettings = { containerName: settings.blobStorage.container, storageAccountOrConnectionString: settings.blobStorage.connectionString};
- this.use(new TranscriptLoggerMiddleware(new AzureBlobTranscriptStore(blobStorageSettings)));
+ this.use(new TranscriptLoggerMiddleware(new BlobsTranscriptStore(settings.blobStorage.connectionString, settings.blobStorage.container)));
this.use(new TelemetryLoggerMiddleware(telemetryClient, true));
this.use(new ShowTypingMiddleware());
this.use(new SetLocaleMiddleware(settings.defaultLocale || 'en-us'));
this.use(new EventDebuggerMiddleware());
- this.use(new SetSpeakMiddleware());
+ this.use(new SetSpeakMiddleware('en-US-JennyNeural', true));
}
private async handleTurnError(turnContext: TurnContext, error: Error): Promise {
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/authentication/allowedCallersClaimsValidator.ts b/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/authentication/allowedCallersClaimsValidator.ts
deleted file mode 100644
index 4ee2bc4b6c..0000000000
--- a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/authentication/allowedCallersClaimsValidator.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Copyright(c) Microsoft Corporation.All rights reserved.
- * Licensed under the MIT License.
- */
-
-import { Claim, JwtTokenValidation, SkillValidation } from 'botframework-connector';
-
-/**
- * Sample claims validator that loads an allowed list from configuration
- * and checks that requests are coming from allowed parent bots.
- */
-export class AllowedCallersClaimsValidator {
- private readonly configKey: string = 'allowedCallers';
- private readonly allowedCallers: string[];
-
- public constructor(allowedCallers: string[]) {
- // AllowedCallers is the setting in the appsettings.json file
- // that consists of the list of parent bot IDs that are allowed to access the skill.
- // To add a new parent bot, simply edit the AllowedCallers and add
- // the parent bot's Microsoft app ID to the list.
- // In this sample, we allow all callers if AllowedCallers contains an "*".
- if (allowedCallers === undefined) {
- throw new Error('allowedCallers parameter is undefined.');
- }
-
- this.allowedCallers = allowedCallers;
- }
-
- public async validateClaims(claims: Claim[]): Promise {
- // If _allowedCallers contains an "*", we allow all callers.
- if (SkillValidation.isSkillClaim(claims) && !this.allowedCallers.includes('*')) {
- // Check that the appId claim in the skill request is in the list of callers configured for this bot.
- const appId: string = JwtTokenValidation.getAppIdFromClaims(claims);
- if (!this.allowedCallers.includes(appId)) {
- throw new Error(`Received a request from a bot with an app ID of ${ appId }. To enable requests from this caller, add the app ID to your configuration file.`);
- }
- }
-
- return Promise.resolve();
- }
-}
\ No newline at end of file
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/authentication/index.ts b/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/authentication/index.ts
deleted file mode 100644
index 88d0178322..0000000000
--- a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/authentication/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Copyright(c) Microsoft Corporation.All rights reserved.
- * Licensed under the MIT License.
- */
-
-export * from './allowedCallersClaimsValidator';
\ No newline at end of file
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/index.ts b/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/index.ts
index 384ed67f45..d0f1481166 100644
--- a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/index.ts
+++ b/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/index.ts
@@ -13,11 +13,12 @@ import {
UserState,
TelemetryLoggerMiddleware } from 'botbuilder';
import { ApplicationInsightsTelemetryClient, ApplicationInsightsWebserverMiddleware, TelemetryInitializerMiddleware } from 'botbuilder-applicationinsights';
-import { CosmosDbPartitionedStorageOptions, CosmosDbPartitionedStorage } from 'botbuilder-azure';
+import { CosmosDbPartitionedStorage } from 'botbuilder-azure';
import {
Dialog } from 'botbuilder-dialogs';
import {
CognitiveModelConfiguration,
+ CosmosDbPartitionedStorageOptions,
LocaleTemplateManager } from 'bot-solutions';
import { join } from 'path';
import * as restify from 'restify';
@@ -32,8 +33,7 @@ import { SkillState } from './models';
import { BotServices } from './services/botServices';
import { IBotSettings } from './services/botSettings';
import { readFileSync, existsSync } from 'fs';
-import { AuthenticationConfiguration, Claim } from 'botframework-connector';
-import { AllowedCallersClaimsValidator } from './authentication';
+import { AuthenticationConfiguration, allowedCallersClaimsValidator } from 'botframework-connector';
const cognitiveModels: Map = new Map();
const cognitiveModelDictionary: { [key: string]: Object } = cognitiveModelsRaw.cognitiveModels;
@@ -104,10 +104,9 @@ supportedLocales.forEach((locale: string) => {
const localeTemplateManager: LocaleTemplateManager = new LocaleTemplateManager(localizedTemplates, settings.defaultLocale || 'en-us');
// Register AuthConfiguration to enable custom claim validation.
-const allowedCallersClaimsValidator: AllowedCallersClaimsValidator = new AllowedCallersClaimsValidator(appsettings.allowedCallers);
const authenticationConfiguration: AuthenticationConfiguration = new AuthenticationConfiguration(
undefined,
- (claims: Claim[]) => allowedCallersClaimsValidator.validateClaims(claims)
+ allowedCallersClaimsValidator(appsettings.allowedCallers)
);
const adapterSettings: Partial = {
diff --git a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/services/botServices.ts b/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/services/botServices.ts
index caf963a890..aecdaa9926 100644
--- a/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/services/botServices.ts
+++ b/templates/typescript/generator-bot-virtualassistant/generators/skill/templates/sample-skill/src/services/botServices.ts
@@ -33,7 +33,7 @@ export class BotServices {
apiVersion: 'v3'
};
- let set: Partial = {
+ const set: Partial = {
luisServices: new Map(),
qnaConfiguration: new Map(),
qnaServices: new Map()