-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding support for additional auth scenarios for Zip Deploy #31999
Conversation
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.
@@ -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(); |
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 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}"; |
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.
userAgentVersion
here seems to come from Microsoft.NET.Sdk.Publish.ZipDeploy.targets
sdk/src/WebSdk/Publish/Targets/PublishTargets/Microsoft.NET.Sdk.Publish.ZipDeploy.targets
Lines 46 to 65 in a603f14
<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> |
sdk/src/WebSdk/Publish/Tasks/Tasks/ZipDeploy/ZipDeploy.cs
Lines 15 to 21 in a603f14
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.
No description provided.