JBildstein/SpiderEye

Expose a Navigating event

bgavrilMS opened this issue · 1 comments

Describe the feature you'd like
The IWindow interface currently exposes events such as Closed, Closing and Shown, but not an event that fires whenever the browser navigates from one page to another. This Navigating would occur before navigation and would advertise the Url.

window.Navigating += (sender, args) => {
    if (args.Url.AbsoluteUri == "https://well.known.url") 
   { 
        _url = args.Url; // capture the final url for later use
         window.Close();
   }
}

On Windows the WebBrowser object exposes a Navigating event. It also exposes a mechanism for cancelling the navigation, which would be very useful.

Reason for this feature request
I'm looking at using a webview (cross-plat) for showing the browser in an Auth SDK (for the project https://github.com/AzureAD/microsoft-authentication-library-for-dotnet)

The way authentication works is that the user navigates to an authorization URL (for example this one) then the server asks the user to authenticate (or reset password or whatever). Several redirects occur. Finally the server redirects the browser to a well-known uri. At this stage, the library that started the browser needs to detect that this final uri has been reached and return the full URL back to the identity SDK, as it contains a GET param with a code that can later be exchanged for a security token.

sorry that took a while but it's implemented now.

The Window class now as a Navigating event that contains the URL it will navigate to and by setting Cancel to true you can stop the request.
The event is fired for each redirect except when using IE, there only the initial URL is sent.

The PageLoaded event now also contains the loaded URL.