Skip to content
Newer
Older
100644 45 lines (33 sloc) 1.49 KB
34172fa Added demo_connect.py for working out how to best connect to the http…
root authored
1 #!/usr/bin/python
2
3 """
2c3463c Update copyrights as we've never required assignment.
mdehaan authored
4 Copyright 2007-2009, Red Hat, Inc and Others
3724392 Update mdehaan's email addr
mdehaan authored
5 Michael DeHaan <michael.dehaan AT gmail>
34172fa Added demo_connect.py for working out how to best connect to the http…
root authored
6
0a9c53a At Spot's suggestion, make sure all source code files include the cor…
Michael DeHaan authored
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
34172fa Added demo_connect.py for working out how to best connect to the http…
root authored
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
0a9c53a At Spot's suggestion, make sure all source code files include the cor…
Michael DeHaan authored
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301 USA
34172fa Added demo_connect.py for working out how to best connect to the http…
root authored
21 """
22
a6a8275 Updated LDAP and authorization code, plus packaging
Michael DeHaan authored
23 from xmlrpclib import ServerProxy
24 import optparse
34172fa Added demo_connect.py for working out how to best connect to the http…
root authored
25
26 if __name__ == "__main__":
a6a8275 Updated LDAP and authorization code, plus packaging
Michael DeHaan authored
27 p = optparse.OptionParser()
28 p.add_option("-u","--user",dest="user",default="test")
29 p.add_option("-p","--pass",dest="password",default="test")
eee7bfa Minor changes to the authn/z test program so they don't go through Ap…
Michael DeHaan authored
30
31 # NOTE: if you've changed your xmlrpc_rw port or
32 # disabled xmlrpc_rw this test probably won't work
33
a8bc2da @invalid-email-address various rearranging; test code uses new port, logging fixes (sort of)
invalid-email-address authored
34 sp = ServerProxy("http://127.0.0.1:25151")
a6a8275 Updated LDAP and authorization code, plus packaging
Michael DeHaan authored
35 (options, args) = p.parse_args()
36 print "- trying to login with user=%s" % options.user
37 token = sp.login(options.user,options.password)
38 print "- token: %s" % token
eee7bfa Minor changes to the authn/z test program so they don't go through Ap…
Michael DeHaan authored
39 print "- authenticated ok, now seeing if user is authorized"
a6a8275 Updated LDAP and authorization code, plus packaging
Michael DeHaan authored
40 check = sp.check_access(token,"imaginary_method_name")
41 print "- access ok? %s" % check
34172fa Added demo_connect.py for working out how to best connect to the http…
root authored
42
43
44
Something went wrong with that request. Please try again.