protected override bool GetAuthCredentials(CefBrowser browser, string originUrl, bool isProxy, string host, int port, string realm,
                                                   string scheme, CefAuthCallback callback)
        {
            if (isProxy)
            {
                callback.Continue(proxySettings.Username, proxySettings.Password);
            }

            return(base.GetAuthCredentials(browser, originUrl, isProxy, host, port, realm, scheme, callback));
        }
Example #2
0
 internal AuthCredentialsEventArgs(string originUrl, bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
 {
     OriginUrl = originUrl;
     IsProxy   = isProxy;
     Host      = host;
     Port      = port;
     Realm     = realm;
     Scheme    = scheme;
     _callback = callback;
 }
Example #3
0
        protected override bool GetAuthCredentials(CefBrowser browser, string originUrl, bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
        {
            //TODO: A custom dialog should be implemented to get username and password here.

            var e = new AuthCredentialsEventArgs(originUrl, isProxy, host, port, realm, scheme, callback);

            _owner.InvokeIfRequired(() => _owner.OnGetAuthCredentials(e));



            return(!e.CancelRequestImmediately);
        }
Example #4
0
 public override bool GetAuthCredentials(bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
 {
     return(_implementation.GetAuthCredentials(isProxy, host, port, realm, scheme, callback));
 }
Example #5
0
 protected override bool GetAuthCredentials(bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
 {
     return(logic.GetAuthCredentials(callback));
 }
 protected override bool GetAuthCredentials(CefBrowser browser, string originUrl, bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
 {
     return(base.GetAuthCredentials(browser, originUrl, isProxy, host, port, realm, scheme, callback));
 }
Example #7
0
        protected override Boolean GetAuthCredentials(CefBrowser browser, CefFrame frame, Boolean isProxy,
                                                      String host, Int32 port, String realm, String scheme, CefAuthCallback callback)
        {
            if (this.Client.HandleUnauthorized != null)
            {
                String username, password;

                if (this.Client.HandleUnauthorized(host, port, realm, scheme, out username, out password))
                {
                    callback.Continue(username, password);
                    return(true);
                }
            }

            Log.Trace("RequestHandler.GetAuthCredentials( browser: {0}, frame: {1}, isProxy: {2}, host: {3}, port: {4}, realm: {5}, scheme: {6} )",
                      browser.Identifier,
                      frame.Identifier,
                      isProxy,
                      host,
                      port,
                      realm,
                      scheme);

            return(false);
            //return base.GetAuthCredentials( browser, frame, isProxy, host, port, realm, scheme, callback );
        }
Example #8
0
 protected internal unsafe override bool GetAuthCredentials(CefBrowser browser, string originUrl, bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
 {
     return(_implementation.GetAuthCredentials(browser, originUrl, isProxy, host, port, realm, scheme, callback));
 }
Example #9
0
 internal protected virtual bool GetAuthCredentials(CefBrowser browser, string originUrl, bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
 {
     return(false);
 }
        bool ICefWebBrowserInternal.OnGetAuthCredentials(CefBrowser browser, CefFrame frame, bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
        {
            bool retVal = false;

            this.DispatchIfRequired(() =>
            {
                try
                {
                    LoginAuthenticationForm authForm = new LoginAuthenticationForm(host);
                    WindowInteropHelper wih          = new WindowInteropHelper(authForm);
                    wih.Owner  = Handle;
                    var result = authForm.ShowDialog();
                    if (result != null && result.HasValue && result.Value)
                    {
                        callback.Continue(authForm.UserName, authForm.Password);
                        retVal = true;
                    }
                    else
                    {
                        callback.Cancel();
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error("Error in GetAuthCredentials.", ex);
                }
            });
            return(retVal);
        }
Example #11
0
        /// <summary>
        /// Called on the IO thread when the browser needs credentials from the user.
        /// </summary>
        /// <param name="isProxy">Indicates whether the <paramref name="host"/> is a proxy server.</param>
        /// <param name="host">The hostname.</param>
        /// <param name="port">The port number.</param>
        /// <param name="realm">
        /// The realm is used to describe the protected area or to indicate the scope of protection.
        /// </param>
        /// <param name="scheme">The authentication scheme.</param>
        /// <param name="callback">
        /// The callback used to asynchronous continuation/cancellation of authentication requests.
        /// </param>
        /// <returns>
        /// Return true to continue the request and call <see cref="CefAuthCallback.Continue"/>
        /// when the authentication information is available. If the request has an associated
        /// browser/frame then returning false will result in a call to GetAuthCredentials on the
        /// <see cref="CefReadHandler"/> associated with that browser, if any. Otherwise,
        /// returning false will cancel the request immediately.
        /// </returns>
        /// <remarks>
        /// This function will only be called for requests initiated from the browser process.
        /// </remarks>
        protected internal override bool GetAuthCredentials(bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
        {
            if (_authentication is null)
            {
                return(false);
            }

            RequestOperation op = _activeOperation;

            if (op is null)
            {
                return(false);
            }

            Task <NetworkCredential> getCredentialTask = _authentication.GetCredentialAsync(isProxy, host, port, realm, scheme, op.cancellationToken);

            if (getCredentialTask is null)
            {
                return(false);
            }

            getCredentialTask.ContinueWith(t =>
            {
                NetworkCredential credential = (t.Status == TaskStatus.RanToCompletion) ? t.Result : null;
                if (credential is null)
                {
                    callback.Cancel();
                }
                else
                {
                    callback.Continue(credential.UserName, credential.Password);
                }
            }, op.cancellationToken, TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.DenyChildAttach, TaskScheduler.Default);
            return(true);
        }
 protected override bool GetAuthCredentials(CefBrowser browser, CefFrame frame, bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
 {
     // Note : this event is fired on the CEF IO Thread. Before showing the auth dialog the call should be marshalled to the UI thread of the browser process
     return(_core.OnGetAuthCredentials(browser, frame, isProxy, host, port, realm, scheme, callback));
 }
Example #13
0
        /// <summary>
        /// Called on the IO thread when the browser needs credentials from the user.
        /// </summary>
        /// <param name="isProxy">Indicates whether the <paramref name="host"/> is a proxy server.</param>
        /// <param name="host">The hostname.</param>
        /// <param name="port">The port number.</param>
        /// <param name="realm">
        /// The realm is used to describe the protected area or to indicate the scope of protection.
        /// </param>
        /// <param name="scheme">The authentication scheme.</param>
        /// <param name="callback">
        /// The callback used to asynchronous continuation/cancellation of authentication requests.
        /// </param>
        /// <returns>
        /// Return true to continue the request and call <see cref="CefAuthCallback.Continue"/>
        /// when the authentication information is available. If the request has an associated
        /// browser/frame then returning false will result in a call to GetAuthCredentials on the
        /// <see cref="CefReadHandler"/> associated with that browser, if any. Otherwise,
        /// returning false will cancel the request immediately.
        /// </returns>
        /// <remarks>
        /// This function will only be called for requests initiated from the browser process.
        /// </remarks>
        protected internal override bool GetAuthCredentials(bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
        {
            if (_authentication is null)
            {
                return(false);
            }

            RequestOperation op = _activeOperation;

            if (op is null)
            {
                return(false);
            }

            Task <NetworkCredential> getCredentialTask = _authentication.GetCredentialAsync(isProxy, host, port, realm, scheme, op.cancellationToken);

            if (getCredentialTask is null)
            {
                return(false);
            }

            getCredentialTask.ContinueWith(t =>
            {
                NetworkCredential credential = (t.Status == TaskStatus.RanToCompletion) ? t.Result : null;
                if (credential is null)
                {
                    callback.Cancel();
                }
                callback.Continue(credential.UserName, credential.Password);
            }).ConfigureAwait(false);
            return(true);
        }
 protected override bool GetAuthCredentials(CefBrowser browser, string originUrl, bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback)
 {
     using (callback) {
         if (OwnerWebView.ProxyAuthentication != null)
         {
             callback.Continue(OwnerWebView.ProxyAuthentication.UserName, OwnerWebView.ProxyAuthentication.Password);
         }
         return(true);
     }
 }