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

[Feature Request] WebView2 embedded browser #1398

Closed
6 tasks
jmprieur opened this issue Sep 23, 2019 · 31 comments · Fixed by #2420
Closed
6 tasks

[Feature Request] WebView2 embedded browser #1398

jmprieur opened this issue Sep 23, 2019 · 31 comments · Fixed by #2420
Assignees
Milestone

Comments

@jmprieur
Copy link
Contributor

jmprieur commented Sep 23, 2019

Is your feature request related to a problem? Please describe.

On the desktop, an embedded browser only exists on .net45 and it is using an old version of Internet Explorer.

We need an embedded browser that:

  • also work on .Net Core on Windows
  • uses Edge as the actual engine (Edge is needed to satisfy the Fido scenario)

This browser is WebView2.

Stream of work:

  • Refactor current WebBrowser implementation to extract out marshalling to UI thread and maybe hosting in a panel

  • Add a WebView2 implementation of embedded browser on .NET Fx and .NET 5 https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/win32. Currently thinking it should go in the box with .NET Fx.

  • Change the WebUiFactory to prefer WebView2 if it is installed

  • Docs and log messages to tell ppl how to install WebView2

  • (Stretch goal) Add an WithEmbeddedWebViewOptions to MSAL that exposes an enum stating "PreferredBrowser" with values - Auto (default) - which means automatic fallback to WebBrowser, WebView2, LegacyWebBrowser.

  • (Stretch goal) Change MSAL.Desktop to add support for WebView2 on .net core 3.1. We should have 1 method that pull in all the MSAL.Desktop functionality, smth like .WithDesktopFeatures()

  • Goal for MSAL 5 - review the default browser selection. For example for B2C we should no longer allow LegacyWebBrowser as it is unusable.

@henrik-me @jmprieur to review the stretch goals.

Technical aspects:

You can use GetAvailableCoreWebView2BrowserVersionString/CoreWebView2Environment.GetAvailableBrowserVersionString to detect if a compatible version of the browser or runtime is installed.]
How can we disable:
o The context menu
CoreWebView2Settings.AreDefaultContextMenusEnabled]
o The developer tools (F12)
CoreWebView2Settings.AreDevToolsEnabled]
o The go back / go forward keys
I don’t think we have a way to do this one.]

Is there an equivalent to WebBrowser.DocumentTitleChanged and WebBrowser.Title ?
[davris: Yes DocumentTitle and DocumentTitleChanged]

@bgavrilMS
Copy link
Member

  1. I agree with adding a new platform, but we should be wary of adding a new SKU (x-ms-client-sku). While this will give us better telemetry, AAD has so many feature flags that are tied to the SKU string that it will be a bug farm to find them all.

  2. We might have to use a WPF panel instead of a WinForms panel if we want high DPI support.

@jmprieur
Copy link
Contributor Author

jmprieur commented Sep 23, 2019

@bgavrilMS :
For 1, which SKU would we reuse? (Desktop, I'm assuming) ?
For 2, I believe that .NET Core 3.0 supports HDPI (see the link above)

@bgavrilMS
Copy link
Member

For 1, I would reuse the .net core SKU, which is MSAL.NetCore

@jmprieur jmprieur added this to the 4.4.1 milestone Sep 23, 2019
@jennyf19 jennyf19 modified the milestones: 4.4.1, 4.5.1 Oct 9, 2019
@bgavrilMS
Copy link
Member

Probably blocked by novotnyllc/MSBuildSdkExtras#191
Work can still happen, but we won't be able to pack.

@trickpatty
Copy link

I see that this work is blocked for the time being. Is there a workaround that you might suggest in order to use this package in a .NET Core 3.0 project?

@jmprieur jmprieur changed the title [Feature Request] Support .NET Core 3.0 [Feature Request] Support .NET Core 3.0 specific features Nov 22, 2019
@jmprieur
Copy link
Contributor Author

jmprieur commented Nov 22, 2019

@trickpatty : You can actually use MSAL.NET in a .NET Core 3.0 project already. We have several samples which were updated and work perfectly fine:

This work item is about supporting the embedded browser control on Windows on providing an extra target to benefit from crypto operations which are more reliable on all OS where .NET Core 3 is supported (today there can be a difference of behavior depending on the .NET framework version. See Also #1453

@bgavrilMS bgavrilMS changed the title [Feature Request] Support .NET Core 3.0 specific features [Feature Request] Support .NET Core 3.0 system.forms embedded browser Nov 22, 2019
@bgavrilMS
Copy link
Member

I renamed the feature request to make it more clear. @jmprieur "better crypto" is not well defined, is there a specific benefit that you have in mind?

@jmprieur
Copy link
Contributor Author

Thanks @bgavrilMS : I've updated my comment.

@henrik-me henrik-me changed the title [Feature Request] Support .NET Core 3.0 system.forms embedded browser [Feature Request] Support .NET Core 3.0 target and the embedded browser for the netcore target Dec 16, 2019
@henrik-me
Copy link
Contributor

henrik-me commented Jan 14, 2020

Important info regarding the timeline:
We are currently prioritizing work that will enable us to ship a netcore 3 target without a dependency on WinForms of WPF for our confidential client (web app/service scenarios).

@henrik-me
Copy link
Contributor

@jmprieur : Thinking this feature should be solely about supporting Edge? Perhaps a separate feature to potentially support a specific netcore3/3.1 target/netstandard?

Asides:
For WebView2 (Edge Chromium): https://docs.microsoft.com/en-us/microsoft-edge/hosting/webview2
For WebView (Wrapping UWP controls in WinForms and WPF): https://docs.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/webview

@bgavrilMS bgavrilMS added this to the 4.24.0 milestone Nov 23, 2020
@bgavrilMS
Copy link
Member

WebView2 has GA-ed. Let's try to use it in 4.24

@Xanen
Copy link

Xanen commented Jan 4, 2021

I see that 4.24 has released but it appears this didn't make the cut. Using Google as an IDP via an embedded browser on desktop has been broken for quite some time now. I believe the issue was originally reported here: #1561. It's been causing a lot of problems for users of my app that have had to create new accounts because their Google login stopped working. Any updates? Will this be addressed in 4.25? Is there anything that can be done in the meantime apart from using the System browser? That's not really a user-experience I'd feel comfortable pushing out. Thanks!

@jmprieur
Copy link
Contributor Author

jmprieur commented Jan 4, 2021

@Xanen. for the moment, you'd need to use the system browser.
We are prioritizing implementing the embedded browser, though. @bgavrilMS will elaborate on when this would be available;

@henrik-me
Copy link
Contributor

@jmprieur @bgavrilMS : If google disallows embedded browsers this feature is not for the scenario @Xanen mentions? Not sure if WAM will work in that case either? Not sure how the Google IDP issue can be solved outside of using the System Browser as that is what Google wants people to use, also it's what Google does for all their own services (afaik).

@Xanen
Copy link

Xanen commented Jan 4, 2021

image
Fwiw, the google drive desktop app does not require opening the system browser (but does provide the option to do so).

@henrik-me
Copy link
Contributor

It's possible they have their own app on an allowlist.

@bgavrilMS
Copy link
Member

WAM cannot be used with b2c (i'll follow this up). ETA for WebView2 is this quarter.

@bgavrilMS bgavrilMS modified the milestones: 4.24.0, 4.26.0 Jan 14, 2021
@jmprieur
Copy link
Contributor Author

jmprieur commented Feb 4, 2021

  • factory to choose the old and new control
  • implementation in .NET classic
  • implementation on .NET 5

@trwalke trwalke modified the milestones: 4.26.0, 4.27.0 Feb 11, 2021
@bgavrilMS bgavrilMS changed the title [Feature Request] Edge embedded browser on .net and .net core [Feature Request] WebView embedded browser on .net and .net5 Feb 11, 2021
@bgavrilMS bgavrilMS changed the title [Feature Request] WebView embedded browser on .net and .net5 [Feature Request] WebView2 embedded browser on .net and .net5 Feb 11, 2021
@bgavrilMS bgavrilMS changed the title [Feature Request] WebView2 embedded browser on .net and .net5 [Feature Request] WebView2 embedded browser Feb 15, 2021
@trwalke trwalke modified the milestones: 4.27.0, 4.28.0 Feb 19, 2021
@bgavrilMS bgavrilMS linked a pull request Feb 25, 2021 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.