source: TI12-security/trunk/python/NDG/attAuthority_services.py @ 1176

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/NDG/attAuthority_services.py@1176
Revision 1176, 10.5 KB checked in by pjkersha, 14 years ago (diff)

Changes to incoporate new getHostInfo Attribute Authority WS method.

Tests/AttAuthorityIOtest.py: new unit test test method

Tests/SecurityClientTest?.py: minor changes to test settings

dist/NDG-Security-0.68.tar.gz: new distribution

www/html/attAuthority.wsdl: updated WSDL contains getHostInfo method.

conf/mapConfig.xml: contains new tags for information about the service provider of the AA e.g. loginURI,
service provider name. This is used by the new getHostInfo WS method.

conf/attAuthorityProperties.xml: remove old commented out tags.

NDG/AttAuthorityIO.py: added HostInfo?* classes for handling getHostInfo WS method I/O.

NDG/attAuthority_services_server.py and NDG/attAuthority_services.py: updated inline with WSDL changes.

NDG/AttAuthority.py:

  • readMapConfig updated to include new 'thisHost' tags.
  • self.mapConfig dictionary re-ordered to include top level keys 'thisHost' and 'trustedHosts'
  • New hostInfo property

NDG/AttCert.py: trivial fixes to commenting

NDG/XMLMsg.py: simplify error message for "Invalid keywords set for update..." error

NDG/CredWallet.py:

  • Client public key is now read in at the point where the corresponding pub key file path is set - i.e. in

setClntPubKeyFilePath method. This means the equivalent code in reqAuthorisation is not needed.

  • reqAuthorisation method has a new flag refreshAttCert. If set, the wallet is checked first for an existing

AC issued by the target AA. If found this is returned, and the call to the AA is skipped.

NDG/SecurityClient.py: added AttAuthorityClient?.getHostInfo WS wrapper method.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1##################################################
2# attAuthority_services.py
3# generated by ZSI.wsdl2python
4#
5#
6##################################################
7
8
9import urlparse, types
10from ZSI.TCcompound import Struct
11from ZSI import client
12import ZSI
13
14class attAuthorityServiceInterface:
15    def getattAuthority(self, portAddress=None, **kw):
16        raise NonImplementationError, "method not implemented"
17
18
19class attAuthorityServiceLocator(attAuthorityServiceInterface):
20    attAuthority_address = ""
21    def getattAuthorityAddress(self):
22        return attAuthorityServiceLocator.attAuthority_address
23
24    def getattAuthority(self, portAddress=None, **kw):
25        return attAuthorityBindingSOAP(portAddress or attAuthorityServiceLocator.attAuthority_address, **kw)
26
27
28class attAuthorityBindingSOAP:
29
30    def __init__(self, addr, **kw):
31        netloc = (urlparse.urlparse(addr)[1]).split(":") + [80,]
32        if not kw.has_key("host"):
33            kw["host"] = netloc[0]
34        if not kw.has_key("port"):
35            kw["port"] = int(netloc[1])
36        if not kw.has_key("url"):
37            kw["url"] =  urlparse.urlparse(addr)[2]
38        self.binding = client.Binding(**kw)
39
40
41    def getHostInfo(self, request):
42        """
43        @param: request to hostInfoRequest::
44          _hostInfoReq: str
45
46        @return: response from hostInfoResponse::
47          _hostInfoResp: str
48        """
49
50        if not isinstance(request, hostInfoRequest) and\
51            not issubclass(hostInfoRequest, request.__class__):
52            raise TypeError, "%s incorrect request type" %(request.__class__)
53        kw = {}
54        response = self.binding.Send(None, None, request, soapaction="urn:attAuthority#getHostInfo", **kw)
55        response = self.binding.Receive(hostInfoResponseWrapper())
56        if not isinstance(response, hostInfoResponse) and\
57            not issubclass(hostInfoResponse, response.__class__):
58            raise TypeError, "%s incorrect response type" %(response.__class__)
59        return response
60
61
62    def getPubKey(self, request):
63        """
64        @param: request to pubKeyRequest::
65          _pubKeyReq: str
66
67        @return: response from pubKeyResponse::
68          _pubKeyResp: str
69        """
70
71        if not isinstance(request, pubKeyRequest) and\
72            not issubclass(pubKeyRequest, request.__class__):
73            raise TypeError, "%s incorrect request type" %(request.__class__)
74        kw = {}
75        response = self.binding.Send(None, None, request, soapaction="urn:attAuthority#getPubKey", **kw)
76        response = self.binding.Receive(pubKeyResponseWrapper())
77        if not isinstance(response, pubKeyResponse) and\
78            not issubclass(pubKeyResponse, response.__class__):
79            raise TypeError, "%s incorrect response type" %(response.__class__)
80        return response
81
82
83    def getTrustedHostInfo(self, request):
84        """
85        @param: request to trustedHostInfoRequest::
86          _trustedHostInfoReq: str
87
88        @return: response from trustedHostInfoResponse::
89          _trustedHostInfoResp: str
90        """
91
92        if not isinstance(request, trustedHostInfoRequest) and\
93            not issubclass(trustedHostInfoRequest, request.__class__):
94            raise TypeError, "%s incorrect request type" %(request.__class__)
95        kw = {}
96        response = self.binding.Send(None, None, request, soapaction="urn:attAuthority#getTrustedHostInfo", **kw)
97        response = self.binding.Receive(trustedHostInfoResponseWrapper())
98        if not isinstance(response, trustedHostInfoResponse) and\
99            not issubclass(trustedHostInfoResponse, response.__class__):
100            raise TypeError, "%s incorrect response type" %(response.__class__)
101        return response
102
103
104    def reqAuthorisation(self, request):
105        """
106        @param: request to authorisationRequest::
107          _authorisationReq: str
108
109        @return: response from authorisationResponse::
110          _authorisationResp: str
111        """
112
113        if not isinstance(request, authorisationRequest) and\
114            not issubclass(authorisationRequest, request.__class__):
115            raise TypeError, "%s incorrect request type" %(request.__class__)
116        kw = {}
117        response = self.binding.Send(None, None, request, soapaction="urn:attAuthority#reqAuthorisation", **kw)
118        response = self.binding.Receive(authorisationResponseWrapper())
119        if not isinstance(response, authorisationResponse) and\
120            not issubclass(authorisationResponse, response.__class__):
121            raise TypeError, "%s incorrect response type" %(response.__class__)
122        return response
123
124
125
126class authorisationRequest (ZSI.TCcompound.Struct): 
127    def __init__(self, name=None, ns=None):
128        self._authorisationReq = None
129
130        oname = None
131        if name:
132            oname = name
133            if ns:
134                oname += ' xmlns="%s"' % ns
135            ZSI.TC.Struct.__init__(self, authorisationRequest, [ZSI.TC.String(pname="authorisationReq",aname="_authorisationReq",optional=1),], pname=name, aname="_%s" % name, oname=oname )
136
137class authorisationRequestWrapper(authorisationRequest):
138    """wrapper for rpc:encoded message"""
139
140    typecode = authorisationRequest(name='reqAuthorisation', ns='urn:attAuthority')
141    def __init__( self, name=None, ns=None, **kw ):
142        authorisationRequest.__init__( self, name='reqAuthorisation', ns='urn:attAuthority' )
143
144class authorisationResponse (ZSI.TCcompound.Struct): 
145    def __init__(self, name=None, ns=None):
146        self._authorisationResp = None
147
148        oname = None
149        if name:
150            oname = name
151            if ns:
152                oname += ' xmlns="%s"' % ns
153            ZSI.TC.Struct.__init__(self, authorisationResponse, [ZSI.TC.String(pname="authorisationResp",aname="_authorisationResp",optional=1),], pname=name, aname="_%s" % name, oname=oname )
154
155class authorisationResponseWrapper(authorisationResponse):
156    """wrapper for rpc:encoded message"""
157
158    typecode = authorisationResponse(name='reqAuthorisationResponse', ns='urn:attAuthority')
159    def __init__( self, name=None, ns=None, **kw ):
160        authorisationResponse.__init__( self, name='reqAuthorisationResponse', ns='urn:attAuthority' )
161
162class hostInfoRequest (ZSI.TCcompound.Struct): 
163    def __init__(self, name=None, ns=None):
164        self._hostInfoReq = None
165
166        oname = None
167        if name:
168            oname = name
169            if ns:
170                oname += ' xmlns="%s"' % ns
171            ZSI.TC.Struct.__init__(self, hostInfoRequest, [ZSI.TC.String(pname="hostInfoReq",aname="_hostInfoReq",optional=1),], pname=name, aname="_%s" % name, oname=oname )
172
173class hostInfoRequestWrapper(hostInfoRequest):
174    """wrapper for rpc:encoded message"""
175
176    typecode = hostInfoRequest(name='getHostInfo', ns='urn:attAuthority')
177    def __init__( self, name=None, ns=None, **kw ):
178        hostInfoRequest.__init__( self, name='getHostInfo', ns='urn:attAuthority' )
179
180class hostInfoResponse (ZSI.TCcompound.Struct): 
181    def __init__(self, name=None, ns=None):
182        self._hostInfoResp = None
183
184        oname = None
185        if name:
186            oname = name
187            if ns:
188                oname += ' xmlns="%s"' % ns
189            ZSI.TC.Struct.__init__(self, hostInfoResponse, [ZSI.TC.String(pname="hostInfoResp",aname="_hostInfoResp",optional=1),], pname=name, aname="_%s" % name, oname=oname )
190
191class hostInfoResponseWrapper(hostInfoResponse):
192    """wrapper for rpc:encoded message"""
193
194    typecode = hostInfoResponse(name='getHostInfoResponse', ns='urn:attAuthority')
195    def __init__( self, name=None, ns=None, **kw ):
196        hostInfoResponse.__init__( self, name='getHostInfoResponse', ns='urn:attAuthority' )
197
198class pubKeyRequest (ZSI.TCcompound.Struct): 
199    def __init__(self, name=None, ns=None):
200        self._pubKeyReq = None
201
202        oname = None
203        if name:
204            oname = name
205            if ns:
206                oname += ' xmlns="%s"' % ns
207            ZSI.TC.Struct.__init__(self, pubKeyRequest, [ZSI.TC.String(pname="pubKeyReq",aname="_pubKeyReq",optional=1),], pname=name, aname="_%s" % name, oname=oname )
208
209class pubKeyRequestWrapper(pubKeyRequest):
210    """wrapper for rpc:encoded message"""
211
212    typecode = pubKeyRequest(name='getPubKey', ns='urn:attAuthority')
213    def __init__( self, name=None, ns=None, **kw ):
214        pubKeyRequest.__init__( self, name='getPubKey', ns='urn:attAuthority' )
215
216class pubKeyResponse (ZSI.TCcompound.Struct): 
217    def __init__(self, name=None, ns=None):
218        self._pubKeyResp = None
219
220        oname = None
221        if name:
222            oname = name
223            if ns:
224                oname += ' xmlns="%s"' % ns
225            ZSI.TC.Struct.__init__(self, pubKeyResponse, [ZSI.TC.String(pname="pubKeyResp",aname="_pubKeyResp",optional=1),], pname=name, aname="_%s" % name, oname=oname )
226
227class pubKeyResponseWrapper(pubKeyResponse):
228    """wrapper for rpc:encoded message"""
229
230    typecode = pubKeyResponse(name='getPubKeyResponse', ns='urn:attAuthority')
231    def __init__( self, name=None, ns=None, **kw ):
232        pubKeyResponse.__init__( self, name='getPubKeyResponse', ns='urn:attAuthority' )
233
234class trustedHostInfoRequest (ZSI.TCcompound.Struct): 
235    def __init__(self, name=None, ns=None):
236        self._trustedHostInfoReq = None
237
238        oname = None
239        if name:
240            oname = name
241            if ns:
242                oname += ' xmlns="%s"' % ns
243            ZSI.TC.Struct.__init__(self, trustedHostInfoRequest, [ZSI.TC.String(pname="trustedHostInfoReq",aname="_trustedHostInfoReq",optional=1),], pname=name, aname="_%s" % name, oname=oname )
244
245class trustedHostInfoRequestWrapper(trustedHostInfoRequest):
246    """wrapper for rpc:encoded message"""
247
248    typecode = trustedHostInfoRequest(name='getTrustedHostInfo', ns='urn:attAuthority')
249    def __init__( self, name=None, ns=None, **kw ):
250        trustedHostInfoRequest.__init__( self, name='getTrustedHostInfo', ns='urn:attAuthority' )
251
252class trustedHostInfoResponse (ZSI.TCcompound.Struct): 
253    def __init__(self, name=None, ns=None):
254        self._trustedHostInfoResp = None
255
256        oname = None
257        if name:
258            oname = name
259            if ns:
260                oname += ' xmlns="%s"' % ns
261            ZSI.TC.Struct.__init__(self, trustedHostInfoResponse, [ZSI.TC.String(pname="trustedHostInfoResp",aname="_trustedHostInfoResp",optional=1),], pname=name, aname="_%s" % name, oname=oname )
262
263class trustedHostInfoResponseWrapper(trustedHostInfoResponse):
264    """wrapper for rpc:encoded message"""
265
266    typecode = trustedHostInfoResponse(name='getTrustedHostInfoResponse', ns='urn:attAuthority')
267    def __init__( self, name=None, ns=None, **kw ):
268        trustedHostInfoResponse.__init__( self, name='getTrustedHostInfoResponse', ns='urn:attAuthority' )
Note: See TracBrowser for help on using the repository browser.