473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Authentication for XML-RPC Calls

The only documentation regarding doing authentication for XML-RPC I
can find is -

"Both the HTTP and HTTPS transports support the URL syntax extension
for HTTP Basic Authentication: http://user:pass@host:port/path. The
user:pass portion will be base64-encoded as an HTTP `Authorization'
header, and sent to the remote server as part of the connection
process when invoking an XML-RPC method. You only need to use this if
the remote server requires a Basic Authentication user and password."

- from http://docs.python.org/lib/module-xmlrpclib.html

Is this really the only way to do authentication for XML-RPC calls?

Like this:
server = xmlrpclib.Server('http://adam:fred123@localhost/zidestore/so/
adam/'

This works, but is pretty ugly. Is there no way to setup the
authentication through properties (like in most XML-RPC bindings),
like:

server = xmlrpclib.Server('http://localhost/zidestore/so/adam/'
server.Username = 'adam'
server.Password = 'fred123'
Jul 22 '08 #1
1 5646
whitemice wrote:
The only documentation regarding doing authentication for XML-RPC I
can find is -

"Both the HTTP and HTTPS transports support the URL syntax extension
for HTTP Basic Authentication: http://user:pass@host:port/path. The
user:pass portion will be base64-encoded as an HTTP `Authorization'
header, and sent to the remote server as part of the connection
process when invoking an XML-RPC method. You only need to use this if
the remote server requires a Basic Authentication user and password."

- from http://docs.python.org/lib/module-xmlrpclib.html

Is this really the only way to do authentication for XML-RPC calls?

Like this:
server = xmlrpclib.Server('http://adam:fred123@localhost/zidestore/so/
adam/'

This works, but is pretty ugly. Is there no way to setup the
authentication through properties (like in most XML-RPC bindings),
like:

server = xmlrpclib.Server('http://localhost/zidestore/so/adam/'
server.Username = 'adam'
server.Password = 'fred123'
Just write a little factory class that does it for you:

import urlparse

class myauth(object):
def __init__(self, scheme = None, domain = None, path = None):
self.scheme = scheme
self.domain = domain
self.path = path
self.Username = None
self.Password = None

def __str__(self):

for attr in ['scheme', 'domain', 'path', 'Username', 'Password']:
if getattr(self, attr) is None:
raise ValueError('No %s attribute value given' % attr)

url=urlparse.urlunsplit((self.scheme,
'%s:%s@%s' % (self.Username, self.Password, self.domain),
self.path, '', ''))

return url

if __name__ == "__main__":
auth = auth = myauth(scheme = 'http', domain = 'localhost',
path='/zidestore/so/adam/')

auth.Username = 'adam'
auth.Password = 'fred123'
print auth
In program

auth = myauth(scheme = 'http', domain = 'localhost',
path = '/zidestore/so/adam')

auth.Username = 'adam'
auth.Password = 'fred123'

print auth

'http://adam:fr*****@docs.python.org/params;/lib/module-xmlrpclib.html'
>>>
-Larry
Jul 22 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: s dogwood | last post by:
I'm fairly new to configuring server.xml and web.xml files in tomcat 4. I am trying to require password authentication for access to a subdirectory called "update" located within ROOT. I want all...
6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
2
by: Spiff | last post by:
Greetings! I have a web application with basic authentication and i need to read a XML File from the server, to do so i need credentials. So I generate network credential by using the data i get...
3
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be...
3
by: David GB | last post by:
I'm trying to set u forms mode authentiaction on a sub-directory. The web.config for the overall site is set to <authentication mode="None" /> In the sub-directory I have a very simple...
5
by: Maziar Aflatoun | last post by:
Hi everyone, I have a login .aspx page that I like to forward my users to. However, can't do it using <authorization> ..... </authorization> because I need anonymous users to use it without...
0
by: Matt | last post by:
Hi, I am building an asp.net web application using my own library of business objects. I am implementing Forms authentication and have created my own classes that implement IIdentity and...
3
by: Adam J Knight | last post by:
Hi all, I have an app that mostly requires authentication. However there are a couple of pages that don't require authentication.. What do i need in my web.config, to specify these pages...
1
by: Tony Stephens | last post by:
Hi, I've created a small forms based application in c# to test a vendor's product and the web service interface that it exposes. We have deployed two instances of the vendor product one which...
3
by: Enda Manni | last post by:
Hi, I have a gSoap Web Service written using C++, it uses SOAP username and password authentication. I also have a C# form client consuming the web service, all this was working fine until...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.