Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit e15e9f8

Browse files
author
Tracy Boehrer
committed
Simplified DotNet FIC samples
1 parent 46f001c commit e15e9f8

8 files changed

Lines changed: 39 additions & 243 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.5.2.0
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HandlingAttachmentsBot", "HandlingAttachmentsBot.csproj", "{947FDB48-7EE1-28F7-422C-CADC344A6F79}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{947FDB48-7EE1-28F7-422C-CADC344A6F79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{947FDB48-7EE1-28F7-422C-CADC344A6F79}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{947FDB48-7EE1-28F7-422C-CADC344A6F79}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{947FDB48-7EE1-28F7-422C-CADC344A6F79}.Release|Any CPU.Build.0 = Release|Any CPU
17+
EndGlobalSection
18+
GlobalSection(SolutionProperties) = preSolution
19+
HideSolutionNode = FALSE
20+
EndGlobalSection
21+
GlobalSection(ExtensibilityGlobals) = postSolution
22+
SolutionGuid = {F4B3DA7F-690A-4A8F-8DAF-2004BA667EA0}
23+
EndGlobalSection
24+
EndGlobal
Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,32 @@
1-
// Generated with Bot Builder V4 SDK Template for Visual Studio EchoBot v4.22.0
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
23

34
using System.Collections.Generic;
45
using System.Threading;
56
using System.Threading.Tasks;
67
using Microsoft.Bot.Builder;
7-
using Microsoft.Bot.Builder.Dialogs;
88
using Microsoft.Bot.Schema;
9-
using Microsoft.Extensions.Logging;
109

1110
namespace Microsoft.BotBuilderSamples.Bots
1211
{
13-
public class AuthBotFIC<T> : DialogBot<T> where T : Dialog
12+
public class AuthBotFIC : ActivityHandler
1413
{
15-
public AuthBotFIC(ConversationState conversationState, UserState userState, T dialog, ILogger<DialogBot<T>> logger)
16-
: base(conversationState, userState, dialog, logger)
14+
protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
1715
{
16+
var replyText = $"Echo: {turnContext.Activity.Text}";
17+
await turnContext.SendActivityAsync(MessageFactory.Text(replyText, replyText), cancellationToken);
1818
}
1919

2020
protected override async Task OnMembersAddedAsync(IList<ChannelAccount> membersAdded, ITurnContext<IConversationUpdateActivity> turnContext, CancellationToken cancellationToken)
2121
{
22-
foreach (var member in turnContext.Activity.MembersAdded)
22+
var welcomeText = "Hello and welcome!";
23+
foreach (var member in membersAdded)
2324
{
2425
if (member.Id != turnContext.Activity.Recipient.Id)
2526
{
26-
await turnContext.SendActivityAsync(MessageFactory.Text("Welcome to AuthenticationBot using Federated Credentials. Type anything to get logged in. Type 'logout' to sign-out."), cancellationToken);
27+
await turnContext.SendActivityAsync(MessageFactory.Text(welcomeText, welcomeText), cancellationToken);
2728
}
2829
}
2930
}
30-
31-
protected override async Task OnTokenResponseEventAsync(ITurnContext<IEventActivity> turnContext, CancellationToken cancellationToken)
32-
{
33-
Logger.LogInformation("Running dialog with Token Response Event Activity.");
34-
35-
// Run the Dialog with the new Token Response Event Activity.
36-
await Dialog.RunAsync(turnContext, ConversationState.CreateProperty<DialogState>(nameof(DialogState)), cancellationToken);
37-
}
3831
}
3932
}

samples/csharp_dotnetcore/86.bot-authentication-fic/Bots/DialogBot.cs

Lines changed: 0 additions & 50 deletions
This file was deleted.

samples/csharp_dotnetcore/86.bot-authentication-fic/Dialogs/LogoutDialog.cs

Lines changed: 0 additions & 65 deletions
This file was deleted.

samples/csharp_dotnetcore/86.bot-authentication-fic/Dialogs/MainDialog.cs

Lines changed: 0 additions & 99 deletions
This file was deleted.

samples/csharp_dotnetcore/86.bot-authentication-fic/README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Authentication Bot using Federation Identity Certificate (FIC)
1+
# Bot using Federation Identity Credentials
22

3+
Bot Framework v4 bot authentication using Federation Identity Credentials (FIC). Currently, FIC feature is supported single tenant bots only.
34

5+
This bot has been created using [Bot Framework](https://dev.botframework.com/), is shows how to use the bot authentication capabilities of Azure Bot Service. In this sample, we use federated identity certificate configuration to create the Bot Framework Authentication.
46

5-
Bot Framework v4 bot authentication using Federation Identity Certificate (FIC). Currently, FIC feature is supported for Microsoft tenants only.
6-
7-
This bot has been created using [Bot Framework](https://dev.botframework.com/), is shows how to use the bot authencation capabilities of Azure Bot Service. In this sample, we use federated identity certificate configuration to create the Bot Framework Authentication.
7+
This bot uses `FederatedServiceClientCredentialsFactory` which is registered in Startup.cs.
88

99
## Prerequisites
1010

@@ -45,7 +45,7 @@ This bot has been created using [Bot Framework](https://dev.botframework.com/),
4545
- Enter name for the credential and click on Add.
4646
- Navigate to the **App Service** for the bot
4747
- Add the User managed identity created in previous step to the Azure App Service under Configuration -> Identity -> User Assigned Managed Identity.
48-
48+
4949
- Set appsettings.json variables
5050

5151
- MicrosoftAppType: {SingTenant | MultiTenant}
@@ -69,8 +69,5 @@ To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](htt
6969
- [Activity processing](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-concept-activity-processing?view=azure-bot-service-4.0)
7070
- [Azure Bot Service Introduction](https://docs.microsoft.com/azure/bot-service/bot-service-overview-introduction?view=azure-bot-service-4.0)
7171
- [Azure Bot Service Documentation](https://docs.microsoft.com/azure/bot-service/?view=azure-bot-service-4.0)
72-
- [.NET Core CLI tools](https://docs.microsoft.com/en-us/dotnet/core/tools/?tabs=netcore2x)
7372
- [Azure CLI](https://docs.microsoft.com/cli/azure/?view=azure-cli-latest)
7473
- [Azure Portal](https://portal.azure.com)
75-
- [Language Understanding using LUIS](https://docs.microsoft.com/en-us/azure/cognitive-services/luis/)
76-
- [Channels and Bot Connector Service](https://docs.microsoft.com/en-us/azure/bot-service/bot-concepts?view=azure-bot-service-4.0)

samples/csharp_dotnetcore/86.bot-authentication-fic/Startup.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,8 @@ public void ConfigureServices(IServiceCollection services)
5151
// Create the Conversation state. (Used by the Dialog system itself.)
5252
services.AddSingleton<ConversationState>();
5353

54-
// The Dialog that will be run by the bot.
55-
services.AddSingleton<MainDialog>();
56-
5754
// Create the bot as a transient. In this case the ASP Controller is expecting an IBot.
58-
services.AddTransient<IBot, AuthBotFIC<MainDialog>>();
55+
services.AddTransient<IBot, AuthBotFIC>();
5956

6057
services.AddHttpClient().AddControllers().AddNewtonsoftJson(options =>
6158
{

samples/csharp_dotnetcore/86.bot-authentication-fic/appsettings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
"MicrosoftAppId": "",
44
"MicrosoftAppClientId": "",
55
"MicrosoftAppTenantId": "",
6-
"ConnectionName": ""
76
}

0 commit comments

Comments
 (0)