Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for additional auth scenarios for Zip Deploy #31999

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

vijayrkn
Copy link
Contributor

No description provided.

@vijayrkn vijayrkn requested a review from abpiskunov April 24, 2023 17:03
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-WebSDK untriaged Request triage from a team member labels Apr 24, 2023
Copy link
Contributor

@abpiskunov abpiskunov left a comment

Choose a reason for hiding this comment

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

:shipit:

@vijayrkn vijayrkn requested a review from marcpopMSFT April 24, 2023 20:11
@vijayrkn vijayrkn enabled auto-merge (squash) April 24, 2023 21:27
@marcpopMSFT marcpopMSFT disabled auto-merge April 24, 2023 21:28
@marcpopMSFT marcpopMSFT merged commit 05cbe1c into release/7.0.4xx Apr 24, 2023
@marcpopMSFT marcpopMSFT deleted the dev/vramak/EnableAddlnZipDeployAuth branch April 24, 2023 21:28
@@ -11,9 +11,12 @@ namespace Microsoft.NET.Sdk.Publish.Tasks.ZipDeploy
{
internal static class HttpClientHelpers
{
public static async Task<IHttpResponse> PostWithBasicAuthAsync(this IHttpClient client, Uri uri, string username, string password, string contentType, string userAgent, Encoding encoding, Stream messageBody)
internal static readonly string AzureADUserName = Guid.Empty.ToString();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see anything in .NET SDK providing "00000000-0000-0000-0000-000000000000" as the user name to ZipDeploy. Is it hardcoded in Visual Studio, instead?

@@ -93,7 +93,7 @@ public async System.Threading.Tasks.Task<bool> ZipDeployAsync(string zipToPublis
Uri uri = new Uri($"{zipDeployPublishUrl}?isAsync=true", UriKind.Absolute);
string userAgent = $"{UserAgentName}/{userAgentVersion}";
Copy link
Contributor

Choose a reason for hiding this comment

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

userAgentVersion here seems to come from Microsoft.NET.Sdk.Publish.ZipDeploy.targets

<Target Name="ZipDeploy" DependsOnTargets="CreateZipFile">
<PropertyGroup>
<ZipDeployUserAgent Condition="'$(VisualStudioVersion)' == ''">WebSdk</ZipDeployUserAgent>
<ZipDeployUserAgent Condition="'$(VisualStudioVersion)' != ''">WebSdk_VisualStudio_$(VisualStudioVersion)</ZipDeployUserAgent>
</PropertyGroup>
<GetPassword
EncryptedPassword ="$(EncryptedPassword)"
Condition="'$(Password)' == '' And '$(IsGetPasswordEnabled)' == 'true'">
<Output TaskParameter="ClearPassword" PropertyName="Password"/>
</GetPassword>
<ZipDeploy
ZipToPublishPath="$(ZippedPublishContentsPath)"
SiteName="$(DeployIisAppPath)"
PublishUrl="$(PublishUrl)"
DestinationUsername="$(UserName)"
DestinationPassword="$(Password)"
UserAgentVersion="$(ZipDeployUserAgent)"/>
</Target>
private const string UserAgentName = "websdk";
[Required]
public string ZipToPublishPath { get; set; }
[Required]
public string UserAgentVersion { get; set; }

so the whole User-Agent can then be "websdk/WebSdk", which seems a bit redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-WebSDK untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants