Windows authentication for CEF proxy

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Windows authentication for CEF proxy

Postby alifut » Wed Jun 22, 2016 9:23 am

Hi guys,

I have a question about authentication mechanism in CEF. Currently when I need to be authenticated I send my credentials in callback function.

Code: Select all
bool IRequestHandler.GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback)
{
   try
   {
      if (isProxy && _proxySettings != null && _proxySettings.Credentials != null)
      {
         callback.Continue(_proxySettings.Credentials.UserName, _proxySettings.Credentials.UserPassword.SecureStringToString());
         return true;
      }
      return false;
   }
   finally
   {
      if (!callback.IsDisposed)
      {
         callback.Dispose();
      }
   }
}


How I set proxy settings:

Code: Select all
IRequestContext requestContext = _browser.GetBrowser().GetHost().RequestContext;
if (requestContext != null)
{
   string proxyMode = "system";
   IDictionary<string, object> proxyParameters = new Dictionary<string, object>();
   if (proxySettings != null)
   {
      proxyMode = "fixed_servers";
      proxyParameters.Add("server", proxySettings.Address);
   }
   proxyParameters.Add("mode", proxyMode);

   string error;
   if (!requestContext.SetPreference("proxy", proxyParameters, out error))
   {
      Log.Error(new ArgumentException(error), "Error occurs during setting preferences in requestContext");
   }
}


I need to be authenticated with windows credentials. I can't use any dialog with inputs for user name and password. Do you know any ways to do it?
alifut
Newbie
 
Posts: 1
Joined: Wed Jun 22, 2016 9:11 am

Re: Windows authentication for CEF proxy

Postby magreenblatt » Wed Jun 22, 2016 10:54 am

Adding NTLM authentication support is tracked in https://bitbucket.org/chromiumembedded/cef/issues/1150/
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Majestic-12 [Bot] and 60 guests

cron