jsonrpclib icon indicating copy to clipboard operation
jsonrpclib copied to clipboard

Authentication

Open kyrias opened this issue 10 years ago • 4 comments

I haven’t had time to go through the library yet, but how hard would you estimate that it would be to add HTTP basic auth support?

kyrias avatar Mar 27 '15 13:03 kyrias

I haven't tested it, but as it is based on the xmlrpclib transport classes, it should support basic auth as is, using the http://user:pass@host:port/path URL format. (again: not tested).

Else, it would be necessary to work on the Transport and SafeTransport classes to override the creation of the HTTP(S) connection.

tcalmant avatar Mar 27 '15 13:03 tcalmant

I meant something like giving SimpleJSONRPCServer a list of dicts containing combinations of usernames and passwords, so you could have different passwords for different users. I’ll see about looking into it later though.

kyrias avatar Mar 27 '15 13:03 kyrias

In this case, you have to handle the basic authentication in the request handler. You can take a look at this blog post to see how it could be implemented (jsonrpclib inherits from xmlrpclib classes, so it should be easy to port). Maybe this could become a Mixin in jsonrpclib...

tcalmant avatar Mar 27 '15 13:03 tcalmant

(Also, just tested regular basic auth URL syntax, and the header isn’t sent properly, so I will have to look into seeing about that first)

kyrias avatar Mar 27 '15 15:03 kyrias