Skip to content

Commit

Permalink
Escape quotes when opening URL for webauthentication
Browse files Browse the repository at this point in the history
Fixes #117
  • Loading branch information
Morten Nielsen committed Oct 11, 2023
1 parent 66aa5fa commit 9c744d7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<Authors>Morten Nielsen - https://xaml.dev</Authors>
<Company>Morten Nielsen - https://xaml.dev</Company>
<PackageIcon>logo.png</PackageIcon>
<Version>2.3.1</Version>
<PackageValidationBaselineVersion>2.3.0</PackageValidationBaselineVersion>
<Version>2.3.2</Version>
<PackageValidationBaselineVersion>2.3.1</PackageValidationBaselineVersion>
</PropertyGroup>

<ItemGroup Condition="'$(PackageId)'!=''">
Expand Down
2 changes: 1 addition & 1 deletion src/WinUIEx/WebAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private async Task<WebAuthenticatorResult> Authenticate(Uri authorizeUri, Uri ca

var process = new System.Diagnostics.Process();
process.StartInfo.FileName = "rundll32.exe";
process.StartInfo.Arguments = "url.dll,FileProtocolHandler " + authorizeUri.ToString();
process.StartInfo.Arguments = $"url.dll,FileProtocolHandler \"{authorizeUri.ToString().Replace("\"","%22")}\"";
process.StartInfo.UseShellExecute = true;
process.Start();
tasks.Add(taskId, tcs);
Expand Down
2 changes: 1 addition & 1 deletion src/WinUIEx/WinUIEx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageId>WinUIEx</PackageId>
<Product>WinUI Extensions</Product>
<PackageReleaseNotes>
- Added analyzers for some non-functional APIs
- Fixed WebAuthenticator issue not working with FireFox (#117)
</PackageReleaseNotes>
</PropertyGroup>

Expand Down
8 changes: 7 additions & 1 deletion src/WinUIExSample/MockOAuthServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ private async void WebServer()
{
writer.WriteLine($"<input type=\"hidden\" name=\"{key}\" value=\"{context.Request.QueryString[key].Replace("\"", "&quot;")}\" />");
}
writer.WriteLine("</form></div></body></html>");
writer.WriteLine("</form></div>");
writer.WriteLine("<hr/><b>Values sent:</b><br/>");
foreach(var key in context.Request.QueryString.AllKeys)
{
writer.WriteLine($"&nbsp;&nbsp;&nbsp;{key}: = {context.Request.QueryString[key]}<br/>");
}
writer.WriteLine("</body></html>");
}
}
}
Expand Down

0 comments on commit 9c744d7

Please sign in to comment.