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

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

AttAuthorityClientTest?.py: test harness for Attribute Authority WS client

SessionClientTest?.py: modifed to use pyunit

sessionMgr.wsdl, attAuthority.wsdl, sessionMgr_services.py, attAuthority_services.py,
attAuthority_services_server.py, sessionMgr_services_server.py:
added getPubKey WS method to allow client to retrieve the public key of the respective service.

mapConfig.xml: removed pubKey tag - use getPubKey WS instead.

sessionMgrProperties.xml: likewise removed sessMgrPubKeyURI tag.

ndgSessionClient.py: --session-mgr-pubkey-uri option -> --session-mgr-pubkey-file. again
because there is now a getPubKey() WS method.

AttAuthorityIO.py/SessionMgrIO.py: added PubKeyReq/PubKeyResp? classes for getPubKey() WS
method.

SessionClient?.py:

  • smPubKeyURI -> smPubKeyFilePath
  • deleted convSMpubKeyURI2File() and replaced with getSessionMgrPubKey()
  • added sessID and encrSessMgrWSDLuri keywords reqAuthorisation() so that it can be used

from SessionMgr?.redirectAuthorisationReq.

  • added getPubKey() wrapper to WS method.

Session.py:

2nd SessionMgr?.

CredWallet?.py: working for mapped certificate handling

  • aaPubKeyFilePath - keep as local var - it imay change between WS calls.
  • Integrated getPubKey WS call into _reqAuthorisation() and getTrustedHostInfo().
  • 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 = "http://glue.badc.rl.ac.uk/attAuthority"
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 getPubKey(self, request):
42        """
43        @param: request to pubKeyRequest::
44          _pubKeyReq: str
45
46        @return: response from pubKeyResponse::
47          _pubKeyResp: str
48        """
49
50        if not isinstance(request, pubKeyRequest) and\
51            not issubclass(pubKeyRequest, request.__class__):
52            raise TypeError, "%s incorrect request type" %(request.__class__)
53        kw = {}
54        response = self.binding.Send(None, None, request, soapaction="urn:attAuthority#getPubKey", **kw)
55        response = self.binding.Receive(pubKeyResponseWrapper())
56        if not isinstance(response, pubKeyResponse) and\
57            not issubclass(pubKeyResponse, response.__class__):
58            raise TypeError, "%s incorrect response type" %(response.__class__)
59        return response
60
61
62    def getTrustedHostInfo(self, request):
63        """
64        @param: request to trustedHostInfoRequest::
65          _trustedHostInfoReq: str
66
67        @return: response from trustedHostInfoResponse::
68          _trustedHostInfoResp: str
69        """
70
71        if not isinstance(request, trustedHostInfoRequest) and\
72            not issubclass(trustedHostInfoRequest, request.__class__):
73            raise TypeError, "%s incorrect request type" %(request.__class__)
74        kw = {}
75        response = self.binding.Send(None, None, request, soapaction="urn:attAuthority#getTrustedHostInfo", **kw)
76        response = self.binding.Receive(trustedHostInfoResponseWrapper())
77        if not isinstance(response, trustedHostInfoResponse) and\
78            not issubclass(trustedHostInfoResponse, response.__class__):
79            raise TypeError, "%s incorrect response type" %(response.__class__)
80        return response
81
82
83    def reqAuthorisation(self, request):
84        """
85        @param: request to authorisationRequest::
86          _authorisationReq: str
87
88        @return: response from authorisationResponse::
89          _authorisationResp: str
90        """
91
92        if not isinstance(request, authorisationRequest) and\
93            not issubclass(authorisationRequest, request.__class__):
94            raise TypeError, "%s incorrect request type" %(request.__class__)
95        kw = {}
96        response = self.binding.Send(None, None, request, soapaction="urn:attAuthority#reqAuthorisation", **kw)
97        response = self.binding.Receive(authorisationResponseWrapper())
98        if not isinstance(response, authorisationResponse) and\
99            not issubclass(authorisationResponse, response.__class__):
100            raise TypeError, "%s incorrect response type" %(response.__class__)
101        return response
102
103
104
105class authorisationRequest (ZSI.TCcompound.Struct): 
106    def __init__(self, name=None, ns=None):
107        self._authorisationReq = None
108
109        oname = None
110        if name:
111            oname = name
112            if ns:
113                oname += ' xmlns="%s"' % ns
114            ZSI.TC.Struct.__init__(self, authorisationRequest, [ZSI.TC.String(pname="authorisationReq",aname="_authorisationReq",optional=1),], pname=name, aname="_%s" % name, oname=oname )
115
116class authorisationRequestWrapper(authorisationRequest):
117    """wrapper for rpc:encoded message"""
118
119    typecode = authorisationRequest(name='reqAuthorisation', ns='urn:attAuthority')
120    def __init__( self, name=None, ns=None, **kw ):
121        authorisationRequest.__init__( self, name='reqAuthorisation', ns='urn:attAuthority' )
122
123class authorisationResponse (ZSI.TCcompound.Struct): 
124    def __init__(self, name=None, ns=None):
125        self._authorisationResp = None
126
127        oname = None
128        if name:
129            oname = name
130            if ns:
131                oname += ' xmlns="%s"' % ns
132            ZSI.TC.Struct.__init__(self, authorisationResponse, [ZSI.TC.String(pname="authorisationResp",aname="_authorisationResp",optional=1),], pname=name, aname="_%s" % name, oname=oname )
133
134class authorisationResponseWrapper(authorisationResponse):
135    """wrapper for rpc:encoded message"""
136
137    typecode = authorisationResponse(name='reqAuthorisationResponse', ns='urn:attAuthority')
138    def __init__( self, name=None, ns=None, **kw ):
139        authorisationResponse.__init__( self, name='reqAuthorisationResponse', ns='urn:attAuthority' )
140
141class pubKeyRequest (ZSI.TCcompound.Struct): 
142    def __init__(self, name=None, ns=None):
143        self._pubKeyReq = None
144
145        oname = None
146        if name:
147            oname = name
148            if ns:
149                oname += ' xmlns="%s"' % ns
150            ZSI.TC.Struct.__init__(self, pubKeyRequest, [ZSI.TC.String(pname="pubKeyReq",aname="_pubKeyReq",optional=1),], pname=name, aname="_%s" % name, oname=oname )
151
152class pubKeyRequestWrapper(pubKeyRequest):
153    """wrapper for rpc:encoded message"""
154
155    typecode = pubKeyRequest(name='getPubKey', ns='urn:attAuthority')
156    def __init__( self, name=None, ns=None, **kw ):
157        pubKeyRequest.__init__( self, name='getPubKey', ns='urn:attAuthority' )
158
159class pubKeyResponse (ZSI.TCcompound.Struct): 
160    def __init__(self, name=None, ns=None):
161        self._pubKeyResp = None
162
163        oname = None
164        if name:
165            oname = name
166            if ns:
167                oname += ' xmlns="%s"' % ns
168            ZSI.TC.Struct.__init__(self, pubKeyResponse, [ZSI.TC.String(pname="pubKeyResp",aname="_pubKeyResp",optional=1),], pname=name, aname="_%s" % name, oname=oname )
169
170class pubKeyResponseWrapper(pubKeyResponse):
171    """wrapper for rpc:encoded message"""
172
173    typecode = pubKeyResponse(name='getPubKeyResponse', ns='urn:attAuthority')
174    def __init__( self, name=None, ns=None, **kw ):
175        pubKeyResponse.__init__( self, name='getPubKeyResponse', ns='urn:attAuthority' )
176
177class trustedHostInfoRequest (ZSI.TCcompound.Struct): 
178    def __init__(self, name=None, ns=None):
179        self._trustedHostInfoReq = None
180
181        oname = None
182        if name:
183            oname = name
184            if ns:
185                oname += ' xmlns="%s"' % ns
186            ZSI.TC.Struct.__init__(self, trustedHostInfoRequest, [ZSI.TC.String(pname="trustedHostInfoReq",aname="_trustedHostInfoReq",optional=1),], pname=name, aname="_%s" % name, oname=oname )
187
188class trustedHostInfoRequestWrapper(trustedHostInfoRequest):
189    """wrapper for rpc:encoded message"""
190
191    typecode = trustedHostInfoRequest(name='getTrustedHostInfo', ns='urn:attAuthority')
192    def __init__( self, name=None, ns=None, **kw ):
193        trustedHostInfoRequest.__init__( self, name='getTrustedHostInfo', ns='urn:attAuthority' )
194
195class trustedHostInfoResponse (ZSI.TCcompound.Struct): 
196    def __init__(self, name=None, ns=None):
197        self._trustedHostInfoResp = None
198
199        oname = None
200        if name:
201            oname = name
202            if ns:
203                oname += ' xmlns="%s"' % ns
204            ZSI.TC.Struct.__init__(self, trustedHostInfoResponse, [ZSI.TC.String(pname="trustedHostInfoResp",aname="_trustedHostInfoResp",optional=1),], pname=name, aname="_%s" % name, oname=oname )
205
206class trustedHostInfoResponseWrapper(trustedHostInfoResponse):
207    """wrapper for rpc:encoded message"""
208
209    typecode = trustedHostInfoResponse(name='getTrustedHostInfoResponse', ns='urn:attAuthority')
210    def __init__( self, name=None, ns=None, **kw ):
211        trustedHostInfoResponse.__init__( self, name='getTrustedHostInfoResponse', ns='urn:attAuthority' )
Note: See TracBrowser for help on using the repository browser.