Example #1
0
 private void WebBrowserNavigatedHandler(object sender, WebBrowserNavigatedEventArgs e)
 {
     if (!this.CheckForClosingUrl(e.Url))
     {
         PlatformPlugin.Logger.Verbose(null,
                                       string.Format(CultureInfo.InvariantCulture, "Navigated to '{0}'.",
                                                     MsalHelpers.UrlDecode(e.Url.ToString())));
     }
 }
Example #2
0
        private void WebBrowserNavigatedHandler(object sender, WebBrowserNavigatedEventArgs e)
        {
            // Guard condition
            if (CheckForClosingUrl(e.Url))
            {
                return;
            }

            string urlDecode = MsalHelpers.UrlDecode(e.Url.ToString());
            string message   = string.Format(CultureInfo.InvariantCulture, "Navigated to '{0}'.", urlDecode);

            RequestContext.Logger.VerbosePii(message);
        }
Example #3
0
        /// <summary>
        /// </summary>
        protected virtual void WebBrowserNavigatingHandler(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (this.DialogResult == DialogResult.OK)
            {
                e.Cancel = true;
                return;
            }

            if (this.webBrowser.IsDisposed)
            {
                // we cancel all flows in disposed object and just do nothing, let object to close.
                // it just for safety.
                e.Cancel = true;
                return;
            }

            if (key == Keys.Back)
            {
                //navigation is being done via back key. This needs to be disabled.
                key      = Keys.None;
                e.Cancel = true;
            }

            // we cancel further processing, if we reached final URL.
            // Security issue: we prohibit navigation with auth code
            // if redirect URI is URN, then we prohibit navigation, to prevent random browser popup.
            e.Cancel = this.CheckForClosingUrl(e.Url);

            // check if the url scheme is of type browser-install://
            // this means we need to launch external browser
            if (e.Url.Scheme.Equals("browser", StringComparison.OrdinalIgnoreCase))
            {
                Process.Start(e.Url.AbsoluteUri.Replace("browser://", "https://"));
                e.Cancel = true;
            }

            if (!e.Cancel)
            {
                PlatformPlugin.Logger.Verbose(null,
                                              string.Format(CultureInfo.InvariantCulture, "Navigating to '{0}'.",
                                                            MsalHelpers.UrlDecode(e.Url.ToString())));
            }
        }