forked from BotBuilderCommunity/botbuilder-community-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTokenExchangeComponent.cs
33 lines (30 loc) · 1.09 KB
/
TokenExchangeComponent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using Microsoft.Bot.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Bot.Builder.Community.Components.TokenExchangeSkillHandler
{
/// <summary>
/// <see cref="BotComponent"/> for registering the TokenExchangeHandler with the ServicesCollection.
/// </summary>
public class TokenExchangeComponent : BotComponent
{
/// <inheritdoc/>
public override void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
var settings = configuration.Get<ComponentSettings>() ?? new ComponentSettings();
if (settings.UseTokenExchangeSkillHandler)
{
services.AddSingleton<ChannelServiceHandlerBase, TokenExchangeSkillHandler>();
}
}
}
}