Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ export class DefaultSettingManager extends FileSettingManager {
maxImbalanceRatio: 10,
maxUtteranceAllowed: 15000,
},
skill: {
skillConfig: {
isSkill: false,
allowedCallers: ['*'],
},
skill: {},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to keep this around even though it's empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Its the object to which we append new skills from the UI. I presonally prefer to keep it so that when new bots are created by default it shows as an empty object and we just keep adding to the dictionary.

defaultLanguage: 'en-us',
languages: ['en-us'],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class AllowedCallersClaimsValidator : ClaimsValidator
{
private readonly List<string> _allowedCallers;

public AllowedCallersClaimsValidator(BotSkillSettings settings)
public AllowedCallersClaimsValidator(BotSkillConfig settings)
{
// skill.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.
Expand Down
8 changes: 6 additions & 2 deletions runtime/dotnet/azurewebapp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public IStorage ConfigureStorage(BotSettings settings)

public bool IsSkill(BotSettings settings)
{
return settings?.Skill?.IsSkill == true;
return settings?.SkillConfig?.IsSkill == true;
}

public BotFrameworkHttpAdapter GetBotAdapter(IStorage storage, BotSettings settings, UserState userState, ConversationState conversationState, IServiceProvider s, TelemetryInitializerMiddleware telemetryInitializerMiddleware)
Expand Down Expand Up @@ -132,7 +132,11 @@ public void ConfigureServices(IServiceCollection services)
// Register AuthConfiguration to enable custom claim validation for skills.
if (IsSkill(settings))
{
services.AddSingleton(sp => new AuthenticationConfiguration { ClaimsValidator = new AllowedCallersClaimsValidator(settings.Skill) });
services.AddSingleton(sp => new AuthenticationConfiguration { ClaimsValidator = new AllowedCallersClaimsValidator(settings.SkillConfig) });
}
else
{
services.AddSingleton(sp => new AuthenticationConfiguration());
}

// register components.
Expand Down
2 changes: 1 addition & 1 deletion runtime/dotnet/core/Settings/BotSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class BotSettings

public string Bot { get; set; }

public BotSkillSettings Skill { get; set; }
public BotSkillConfig SkillConfig { get; set; }

public class BlobStorageConfiguration
{
Expand Down
2 changes: 1 addition & 1 deletion runtime/dotnet/core/Settings/BotSkillSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Microsoft.BotFramework.Composer.Core.Settings
{
public class BotSkillSettings
public class BotSkillConfig
{
// Is skill
public bool IsSkill { get; set; }
Expand Down
12 changes: 6 additions & 6 deletions runtime/dotnet/tests/AllowedCallersClaimsValidationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public class AllowedCallersClaimsValidationTests
[ExpectedException(typeof(ArgumentException))]
public void WhenAllowedCallersIsNullThrowException()
{
var unused = new AllowedCallersClaimsValidator(new BotSkillSettings());
var unused = new AllowedCallersClaimsValidator(new BotSkillConfig());
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void WhenAllowedCallersIsEmptyThrowException()
{
var unused = new AllowedCallersClaimsValidator(new BotSkillSettings()
var unused = new AllowedCallersClaimsValidator(new BotSkillConfig()
{
AllowedCallers = new string[0]
});
Expand All @@ -35,7 +35,7 @@ public void WhenAllowedCallersIsEmptyThrowException()
[TestMethod]
public async Task AllowAnyCaller()
{
var validator = new AllowedCallersClaimsValidator(new BotSkillSettings()
var validator = new AllowedCallersClaimsValidator(new BotSkillConfig()
{
AllowedCallers = new string[]{"*"}
});
Expand All @@ -49,7 +49,7 @@ public async Task AllowAnyCaller()
public async Task AllowedCaller()
{
const string callerAppId = "BE3F9920-D42D-4D3A-9BDF-DBA62DAE3A00";
var validator = new AllowedCallersClaimsValidator(new BotSkillSettings()
var validator = new AllowedCallersClaimsValidator(new BotSkillConfig()
{
AllowedCallers = new string[]{callerAppId}
});
Expand All @@ -63,7 +63,7 @@ public async Task AllowedCaller()
public async Task AllowedCallers()
{
const string callerAppId = "BE3F9920-D42D-4D3A-9BDF-DBA62DAE3A00";
var validator = new AllowedCallersClaimsValidator(new BotSkillSettings()
var validator = new AllowedCallersClaimsValidator(new BotSkillConfig()
{
AllowedCallers = new string[]{"anotherId", callerAppId}
});
Expand All @@ -78,7 +78,7 @@ public async Task AllowedCallers()
public async Task NonAllowedCallerShouldThrowException()
{
var callerAppId = "BE3F9920-D42D-4D3A-9BDF-DBA62DAE3A00";
var validator = new AllowedCallersClaimsValidator(new BotSkillSettings()
var validator = new AllowedCallersClaimsValidator(new BotSkillConfig()
{
AllowedCallers = new string[]{callerAppId}
});
Expand Down