Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Net.Http;
using Microsoft.Extensions.Logging;

Expand Down Expand Up @@ -43,18 +44,18 @@ public static BotFrameworkAuthentication Create(
HttpClient httpClient,
ILogger logger)
{
if (string.IsNullOrEmpty(channelService))
{
return new PublicCloudBotFrameworkAuthentication(credentialFactory, authConfiguration, httpClient, logger);
}
else if (channelService == GovernmentAuthenticationConstants.ChannelService)
{
return new GovernmentCloudBotFrameworkAuthentication(credentialFactory, authConfiguration, httpClient, logger);
}
else
if (
!string.IsNullOrEmpty(toChannelFromBotLoginUrl) ||

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ToChannelFromBotLoginUrl is deprecated in public Azure.

ToChannelFromBotLoginUrl isn't marked as deprecated in Azure Government.

Should we be checking for this value in the air gapped clouds and should the Azure Government value be deprecated?

Should the SDK check for all of these values as a single entity, or can individual values (i.e. oAuthUrl, toBotFromChannelOpenIdMetadataUrl or toBotFromEmulatorOpenIdMetadataUrl) be used and/or different from what is normally associated with the ChannelService/ToChannelFromBotOAuthScope/ToBotFromChannelTokenIssuer matrix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

perhaps @Jeffders and @willportnoy can comment on this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That particular constant might be deprecated, but it's likely this one is in use instead:

public const string ToChannelFromBotLoginUrlTemplate = "https://login.microsoftonline.com/{0}";

I think there might have been some experiment to change the tenant from which we requested a token?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I recall a work stream led by Ming for a customer that needed a more secure chat bot. This is probably that work...

@Jeffders does DL-ASE provide additional security assurances that would render the LoginUrl template less likely to be used?

If it’s still in use and we’re directing customers to this feature/configuration, do we need it in the other clouds? The SDK only supports it in Public Azure.

!string.IsNullOrEmpty(toChannelFromBotOAuthScope) ||
!string.IsNullOrEmpty(toBotFromChannelTokenIssuer) ||
!string.IsNullOrEmpty(oAuthUrl) ||
!string.IsNullOrEmpty(toBotFromChannelOpenIdMetadataUrl) ||
!string.IsNullOrEmpty(toBotFromEmulatorOpenIdMetadataUrl) ||
!string.IsNullOrEmpty(callerId))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@willportnoy is the callerId required? We're following the activity spec and discard of any callerIds received on the wire. What is this callerId used for, if it's not generated from the SDK post-successful authentication of incoming activities?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Based on 5efd3d0 I would guess it's related to skills. Maybe @gabog can comment?

{
// if we have any of the 'parameterized' properties defined we'll assume this is the parameterized code

return new ParameterizedBotFrameworkAuthentication(
channelService,
validateAuthority,
toChannelFromBotLoginUrl,
toChannelFromBotOAuthScope,
Expand All @@ -68,6 +69,25 @@ public static BotFrameworkAuthentication Create(
httpClient,
logger);
}
else
{
// else apply the built in default behavior, which is either the public cloud or the gov cloud depending on whether we have a channelService value present

if (string.IsNullOrEmpty(channelService))
{
return new PublicCloudBotFrameworkAuthentication(credentialFactory, authConfiguration, httpClient, logger);
}
else if (channelService == GovernmentAuthenticationConstants.ChannelService)
{
return new GovernmentCloudBotFrameworkAuthentication(credentialFactory, authConfiguration, httpClient, logger);
}
else
{
// The ChannelService value is used an indicator of which built in set of constants to use. If it is not recognized, a full configuration is expected.

throw new ArgumentException("The provided ChannelService value is not supported.");
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ internal class ParameterizedBotFrameworkAuthentication : BotFrameworkAuthenticat
{
private static HttpClient _defaultHttpClient = new HttpClient();

private readonly string _channelService;
private readonly bool _validateAuthority;
private readonly string _toChannelFromBotLoginUrl;
private readonly string _toChannelFromBotOAuthScope;
Expand All @@ -34,7 +33,6 @@ internal class ParameterizedBotFrameworkAuthentication : BotFrameworkAuthenticat
private readonly ILogger _logger;

public ParameterizedBotFrameworkAuthentication(
string channelService,
bool validateAuthority,
string toChannelFromBotLoginUrl,
string toChannelFromBotOAuthScope,
Expand All @@ -48,7 +46,6 @@ public ParameterizedBotFrameworkAuthentication(
HttpClient httpClient = null,
ILogger logger = null)
{
_channelService = channelService;
_validateAuthority = validateAuthority;
_toChannelFromBotLoginUrl = toChannelFromBotLoginUrl;
_toChannelFromBotOAuthScope = toChannelFromBotOAuthScope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void ConstructorWithConfiguration()
{
{ "MicrosoftAppId", "appId" },
{ "MicrosoftAppPassword", "appPassword" },
{ "ChannelService", "channelService" }
{ "ChannelService", GovernmentAuthenticationConstants.ChannelService }
};

var configuration = new ConfigurationBuilder()
Expand Down