Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit 34877f7

Browse files
committed
Added whitelist auth provider to lib
1 parent 322229b commit 34877f7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Collections.Generic;
2+
using Microsoft.Extensions.Configuration;
3+
4+
namespace Microsoft.Bot.Builder.Skills.Auth
5+
{
6+
/// <summary>
7+
/// Loads the apps whitelist from settings.
8+
/// </summary>
9+
public class WhitelistAuthenticationProvider : IWhitelistAuthenticationProvider
10+
{
11+
public WhitelistAuthenticationProvider(IConfiguration configuration, string whitelistProperty = "skillAuthenticationWhitelist")
12+
{
13+
// skillAuthenticationWhitelist is the setting in appsettings.json file
14+
// that conists of the list of parent bot ids that are allowed to access the skill
15+
// to add a new parent bot simply go to the skillAuthenticationWhitelist and add
16+
// the parent bot's microsoft app id to the list
17+
var section = configuration.GetSection(whitelistProperty);
18+
var appsList = section.Get<string[]>();
19+
AppsWhitelist = appsList != null ? new HashSet<string>(appsList) : null;
20+
}
21+
22+
public HashSet<string> AppsWhitelist { get; }
23+
}
24+
}

0 commit comments

Comments
 (0)