This repository was archived by the owner on Jan 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 486
fix the default behavior when cloud environments are configured #4764
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
|
|
||
|
|
@@ -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) || | ||
| !string.IsNullOrEmpty(toChannelFromBotOAuthScope) || | ||
| !string.IsNullOrEmpty(toBotFromChannelTokenIssuer) || | ||
| !string.IsNullOrEmpty(oAuthUrl) || | ||
| !string.IsNullOrEmpty(toBotFromChannelOpenIdMetadataUrl) || | ||
| !string.IsNullOrEmpty(toBotFromEmulatorOpenIdMetadataUrl) || | ||
| !string.IsNullOrEmpty(callerId)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @willportnoy is the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| { | ||
| // if we have any of the 'parameterized' properties defined we'll assume this is the parameterized code | ||
|
|
||
| return new ParameterizedBotFrameworkAuthentication( | ||
| channelService, | ||
| validateAuthority, | ||
| toChannelFromBotLoginUrl, | ||
| toChannelFromBotOAuthScope, | ||
|
|
@@ -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."); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ToChannelFromBotLoginUrlis deprecated in public Azure.ToChannelFromBotLoginUrlisn'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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
botbuilder-dotnet/libraries/Microsoft.Bot.Connector/Authentication/AuthenticationConstants.cs
Line 25 in 540fadc
I think there might have been some experiment to change the tenant from which we requested a token?
There was a problem hiding this comment.
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.