source: TI12-security/trunk/python/ndg.security.common/ndg/security/common/zsi/attributeauthority/AttributeAuthority_services.py @ 4521

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.common/ndg/security/common/zsi/attributeauthority/AttributeAuthority_services.py@4521
Revision 4521, 3.7 KB checked in by pjkersha, 11 years ago (diff)

Completed tests running Attribute Authority and Session Manager in the same WSGI stack:

  • ndg.security.server.wsgi.utils.attributeauthorityclient.WSGIAttributeAuthorityClient: completed this class and tested in combinedservices unit tests. This class enables WSGI apps to access an AttributeAuthority? WSGI app running in the same stack or else make a callout to a remote SOAP service.
  • ndg.security.server.wsgi.wssecurity: improved config set-up
Line 
1##################################################
2# AttributeAuthority_services.py
3# generated by ZSI.generate.wsdl2python
4##################################################
5
6
7from AttributeAuthority_services_types import *
8import urlparse, types
9from ZSI.TCcompound import ComplexType, Struct
10from ZSI import client
11import ZSI
12from ZSI.generate.pyclass import pyclass_type
13
14# Locator
15class AttributeAuthorityServiceLocator:
16    AttributeAuthority_address = "http://localhost:5000"
17    def getAttributeAuthorityAddress(self):
18        return AttributeAuthorityServiceLocator.AttributeAuthority_address
19    def getAttributeAuthority(self, url=None, **kw):
20        return AttributeAuthorityBindingSOAP(url or AttributeAuthorityServiceLocator.AttributeAuthority_address, **kw)
21
22# Methods
23class AttributeAuthorityBindingSOAP:
24    def __init__(self, url, **kw):
25        kw.setdefault("readerclass", None)
26        kw.setdefault("writerclass", None)
27        # no resource properties
28        self.binding = client.Binding(url=url, **kw)
29        # no ws-addressing
30
31    # op: <ZSI.wstools.WSDLTools.Message instance at 0x84fc98c>
32    def getAttCert(self, userId,userX509Cert,userAttCert):
33
34        request = getAttCertInputMsg()
35        request._userId = userId
36        request._userX509Cert = userX509Cert
37        request._userAttCert = userAttCert
38
39        kw = {}
40        # no input wsaction
41        self.binding.Send(None, None, request, soapaction="getAttCert", **kw)
42        # no output wsaction
43        response = self.binding.Receive(getAttCertOutputMsg.typecode)
44        attCert = response._attCert
45        msg = response._msg
46        return attCert,msg
47
48    # op: <ZSI.wstools.WSDLTools.Message instance at 0x84fccac>
49    def getHostInfo(self):
50
51        request = getHostInfoInputMsg()
52
53        kw = {}
54        # no input wsaction
55        self.binding.Send(None, None, request, soapaction="getHostInfo", **kw)
56        # no output wsaction
57        response = self.binding.Receive(getHostInfoOutputMsg.typecode)
58        hostname = response._hostname
59        aaURI = response._aaURI
60        aaDN = response._aaDN
61        loginURI = response._loginURI
62        loginServerDN = response._loginServerDN
63        loginRequestServerDN = response._loginRequestServerDN
64        return hostname,aaURI,aaDN,loginURI,loginServerDN,loginRequestServerDN
65
66    # op: <ZSI.wstools.WSDLTools.Message instance at 0x85037ec>
67    def getTrustedHostInfo(self, role):
68
69        request = getTrustedHostInfoInputMsg()
70        request._role = role
71
72        kw = {}
73        # no input wsaction
74        self.binding.Send(None, None, request, soapaction="getTrustedHostInfo", **kw)
75        # no output wsaction
76        response = self.binding.Receive(getTrustedHostInfoOutputMsg.typecode)
77        trustedHosts = response._trustedHosts
78        return trustedHosts
79
80    # op: <ZSI.wstools.WSDLTools.Message instance at 0x850396c>
81    def getAllHostsInfo(self):
82
83        request = getAllHostsInfoInputMsg()
84
85        kw = {}
86        # no input wsaction
87        self.binding.Send(None, None, request, soapaction="getAllHostsInfo", **kw)
88        # no output wsaction
89        response = self.binding.Receive(getAllHostsInfoOutputMsg.typecode)
90        hosts = response._hosts
91        return hosts
92
93getAttCertInputMsg = ns0.getAttCert_Dec().pyclass
94
95getAttCertOutputMsg = ns0.getAttCertResponse_Dec().pyclass
96
97getHostInfoInputMsg = ns0.getHostInfo_Dec().pyclass
98
99getHostInfoOutputMsg = ns0.getHostInfoResponse_Dec().pyclass
100
101getTrustedHostInfoInputMsg = ns0.getTrustedHostInfo_Dec().pyclass
102
103getTrustedHostInfoOutputMsg = ns0.getTrustedHostInfoResponse_Dec().pyclass
104
105getAllHostsInfoInputMsg = ns0.getAllHostsInfo_Dec().pyclass
106
107getAllHostsInfoOutputMsg = ns0.getAllHostsInfoResponse_Dec().pyclass
Note: See TracBrowser for help on using the repository browser.