Rovango / cefpython

Automatically exported from code.google.com/p/cefpython
0 stars 0 forks source link

seems not to support basic authentication #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. open a url secured with basic auth

What is the expected output? What do you see instead?
User/Password dialog or Method to implement it

What version of the product are you using? On what operating system?
0.33

Original issue reported on code.google.com by henrik.genssen@gmail.com on 23 Aug 2012 at 6:55

GoogleCodeExporter commented 8 years ago
To support http authentication we need to implement 
CefRequestHandler::GetAuthCredentials():

http://code.google.com/p/cefpython/source/browse/include/cef_request_handler.h#1
50

virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
                                  bool isProxy,
                                  const CefString& host,
                                  int port,
                                  const CefString& realm,
                                  const CefString& scheme,
                                  CefString& username,
                                  CefString& password) { return false; }

Original comment by czarek.t...@gmail.com on 23 Aug 2012 at 7:59

GoogleCodeExporter commented 8 years ago
I've implemented CefRequestHandler but came into issues. Some of the functions 
of that handler run on IO thread and you cannot execute Python on that thread 
and this means trouble, we can bypass it but the solution will make more time. 
Need to figure out how to do asynchronous callbacks for the getauthcredentials.

Original comment by czarek.t...@gmail.com on 24 Aug 2012 at 6:07

GoogleCodeExporter commented 8 years ago
I've had some discussion with Cython users and we have a simple solution for 
all thread problems, there won't be needed any modifications, python code can 
run on any of the threads.

Discussion here:
https://groups.google.com/forum/?fromgroups=#!topic/cython-users/jcvjpSOZPp0

Original comment by czarek.t...@gmail.com on 27 Aug 2012 at 6:03

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Http Authentication is now supported, version 0.36 released, go to Downloads.

Let know if everything works fine.

Original comment by czarek.t...@gmail.com on 29 Aug 2012 at 5:57

GoogleCodeExporter commented 8 years ago
If you would like to provide your own custom implementation of http 
authentication, you are somewhat limited when you do that from pure python.

To provide a custom implementation you need to overwrite  GetAuthCredentials() 
in RequestHandler.

This function is called on IO thread and from what I've tested a GIL lock needs 
to be released for it to work if you want to display a modal dialog window. 
Currently this authentication is implemented by calling DialogBoxIndirect(), 
the source is here:

http://code.google.com/p/cefpython/source/browse/httpauth/AuthDialog.cpp

The only way to implement custom http authentication, as of now, is to display 
a dialog inside the browser by using html/css/javascript, you can do this by 
calling [Browser].GetMainFrame().ExecuteJavascript(). You would need to use 
some kind of "while True" loop with a call to time.sleep() and periodic checks 
to the html/js whether clicked OK/Cancel in your html-based dialog.

Original comment by czarek.t...@gmail.com on 29 Aug 2012 at 6:32

GoogleCodeExporter commented 8 years ago
Project will move to Github. Find this issue at the new address (soon): 
https://github.com/cztomczak/cefpython/issues/8

Original comment by czarek.t...@gmail.com on 24 Aug 2015 at 6:24