source: TI12-security/trunk/python/ndg.security.server/ndg/security/server/SessionMgr/SessionMgr_services_server.py @ 1783

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.server/ndg/security/server/SessionMgr/SessionMgr_services_server.py@1783
Revision 1783, 13.6 KB checked in by pjkersha, 15 years ago (diff)

All Session Manager Client unit tests working with Session Manager service stub over https:

server/SessionMgr/server-config.tac
server/SessionMgr/SessionMgr_services_server.py
common/SessionMgr/SessionMgr_services.py
common/SessionMgr/SessionMgr_services_types.py
common/SessionMgr/init.py - added disconnect method to SessionMgrClient? class.

common/XMLSecDoc.py: comment out xmlsec for the moment. This module will need to be refactored
to use new digital signature code as used in WS-Security code tests.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1##################################################
2# SessionMgr_services_server.py
3#      Generated by ZSI.generate.wsdl2dispatch.DelAuthServiceModuleWriter
4#
5##################################################
6
7from ndg.security.common.SessionMgr.SessionMgr_services import *
8from ZSI.ServiceContainer import ServiceSOAPBinding
9
10class SessionMgrService(ServiceSOAPBinding):
11    soapAction = {}
12    root = {}
13    _wsdl = """<?xml version=\"1.0\" ?>
14<wsdl:definitions name=\"SessionMgr\" targetNamespace=\"urn:ndg:security\" xmlns=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:http=\"http://schemas.xmlsoap.org/wsdl/http/\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"urn:ndg:security\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
15
16  <wsdl:types>
17    <xsd:schema>
18      <xsd:element name=\"addUser\">
19        <xsd:complexType>
20          <xsd:sequence>
21            <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"username\" type=\"xsd:string\"/>
22            <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"passPhrase\" type=\"xsd:string\"/>
23          </xsd:sequence>
24        </xsd:complexType>
25      </xsd:element>
26     
27      <xsd:element name=\"addUserResponse\">
28        <xsd:complexType/>
29      </xsd:element>
30
31      <xsd:element name=\"connect\">
32        <xsd:complexType>
33          <xsd:sequence>
34            <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"username\" type=\"xsd:string\"/>
35            <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"passPhrase\" type=\"xsd:string\"/>
36                    <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"createServerSess\" type=\"xsd:boolean\"/>
37                    <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"getCookie\" type=\"xsd:boolean\"/>
38          </xsd:sequence>
39        </xsd:complexType>
40      </xsd:element>
41     
42      <xsd:element name=\"connectResponse\">
43        <xsd:complexType>
44                  <xsd:sequence>
45                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"cookie\" type=\"xsd:string\"/>
46                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"proxyCert\" type=\"xsd:string\"/>
47                  </xsd:sequence>
48                </xsd:complexType>
49      </xsd:element>
50
51      <xsd:element name=\"disconnect\">
52        <xsd:complexType>
53                  <xsd:sequence>
54                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"proxyCert\" type=\"xsd:string\"/>
55                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"sessID\" type=\"xsd:string\"/>
56                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"encrSessionMgrURI\" type=\"xsd:string\"/>
57                  </xsd:sequence>
58                </xsd:complexType>
59      </xsd:element>
60
61      <xsd:element name=\"disconnectResponse\">
62        <xsd:complexType/>
63      </xsd:element>
64
65          <xsd:element name=\"attCert\" type=\"xsd:string\"/>
66          <xsd:element name=\"trustedHost\" type=\"xsd:string\"/>
67     
68      <xsd:simpleType name=\"attCertList\">
69        <xsd:list itemType=\"tns:attCert\"/>
70      </xsd:simpleType>
71
72      <xsd:simpleType name=\"trustedHostList\">
73                <xsd:list itemType=\"tns:trustedHost\"/>
74      </xsd:simpleType>
75     
76      <xsd:element name=\"reqAuthorisation\">
77        <xsd:complexType>
78                  <xsd:sequence>
79                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"proxyCert\" type=\"xsd:string\"/>
80                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"sessID\" type=\"xsd:string\"/>
81                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"encrSessionMgrURI\" type=\"xsd:string\"/>
82                    <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"attAuthorityURI\" type=\"xsd:string\"/>
83                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"attAuthorityCert\" type=\"xsd:string\"/>
84                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"reqRole\" type=\"xsd:string\"/>
85                    <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"mapFromTrustedHosts\" type=\"xsd:boolean\"/>
86                    <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"rtnExtAttCertList\" type=\"xsd:boolean\"/>
87                        <xsd:element maxOccurs=\"unbounded\" minOccurs=\"0\" name=\"extAttCert\" type=\"xsd:string\"/>
88                        <xsd:element maxOccurs=\"unbounded\" minOccurs=\"0\" name=\"extTrustedHost\" type=\"xsd:string\"/>
89
90<!-- Leave out list handling for now - use maxOccurs=\"unbounded\" instead
91                        <xsd:element name=\"extAttCertList\" type=\"tns:attCertList\" minOccurs=\"0\" maxOccurs=\"1\"/>
92                        <xsd:element name=\"extTrustedHostList\" type=\"tns:trustedHostList\" minOccurs=\"0\" maxOccurs=\"1\"/>
93-->
94                  </xsd:sequence>
95                </xsd:complexType>
96      </xsd:element>
97     
98      <xsd:element name=\"reqAuthorisationResponse\">
99        <xsd:complexType>
100              <xsd:sequence>
101                <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"attCert\" type=\"xsd:string\"/>
102                <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"statusCode\" type=\"xsd:string\"/>
103                        <xsd:element maxOccurs=\"unbounded\" minOccurs=\"0\" name=\"extAttCert\" type=\"xsd:string\"/>
104<!-- Leave out list handling for now - use maxOccurs=\"unbounded\" instead
105                        <xsd:element name=\"extAttCertList\" type=\"tns:attCertList\" minOccurs=\"0\" maxOccurs=\"1\"/>
106-->
107              </xsd:sequence>
108            </xsd:complexType>
109      </xsd:element>
110
111      <xsd:element name=\"getX509Cert\">
112        <xsd:complexType/>
113      </xsd:element>
114     
115      <xsd:element name=\"getX509CertResponse\">
116        <xsd:complexType>
117                  <xsd:sequence>
118                    <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"x509Cert\" type=\"xsd:string\"/>
119                  </xsd:sequence>
120                </xsd:complexType>
121      </xsd:element>
122
123    </xsd:schema>
124  </wsdl:types>
125 
126  <message name=\"addUserInputMsg\">
127    <part element=\"tns:addUser\" name=\"parameters\"/>
128  </message>
129
130  <message name=\"addUserOutputMsg\">
131    <part element=\"tns:addUserResponse\" name=\"parameters\"/>
132  </message>
133 
134  <message name=\"connectInputMsg\">
135    <part element=\"tns:connect\" name=\"parameters\"/>
136  </message>
137
138  <message name=\"connectOutputMsg\">
139    <part element=\"tns:connectResponse\" name=\"parameters\"/>
140  </message>
141 
142  <message name=\"disconnectInputMsg\">
143    <part element=\"tns:disconnect\" name=\"parameters\"/>
144  </message>
145
146  <message name=\"disconnectOutputMsg\">
147    <part element=\"tns:disconnectResponse\" name=\"parameters\"/>
148  </message>
149
150  <message name=\"reqAuthorisationInputMsg\">
151    <part element=\"tns:reqAuthorisation\" name=\"parameters\"/>
152  </message>
153
154  <message name=\"reqAuthorisationOutputMsg\">
155    <part element=\"tns:reqAuthorisationResponse\" name=\"parameters\"/>
156  </message>
157
158  <message name=\"getX509CertInputMsg\">
159    <part element=\"tns:getX509Cert\" name=\"parameters\"/>
160  </message>
161
162  <message name=\"getX509CertOutputMsg\">
163    <part element=\"tns:getX509CertResponse\" name=\"parameters\"/>
164  </message>
165
166  <wsdl:portType name=\"SessionMgr\">
167    <wsdl:operation name=\"addUser\">
168      <wsdl:input message=\"tns:addUserInputMsg\"/>
169      <wsdl:output message=\"tns:addUserOutputMsg\"/>
170    </wsdl:operation>
171
172    <operation name=\"connect\">
173      <wsdl:input message=\"tns:connectInputMsg\"/>
174      <wsdl:output message=\"tns:connectOutputMsg\"/>
175    </operation>
176
177    <operation name=\"disconnect\">
178      <wsdl:input message=\"tns:disconnectInputMsg\"/>
179      <wsdl:output message=\"tns:disconnectOutputMsg\"/>
180    </operation>
181
182    <operation name=\"reqAuthorisation\">
183      <wsdl:input message=\"tns:reqAuthorisationInputMsg\"/>
184      <wsdl:output message=\"tns:reqAuthorisationOutputMsg\"/>
185    </operation>
186
187    <operation name=\"getX509Cert\">
188      <wsdl:input message=\"tns:getX509CertInputMsg\"/>
189      <wsdl:output message=\"tns:getX509CertOutputMsg\"/>
190    </operation>
191  </wsdl:portType> 
192 
193  <wsdl:binding name=\"SessionMgrBinding\" type=\"tns:SessionMgr\">
194    <soap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>
195
196    <operation name=\"addUser\">
197      <soap:operation soapAction=\"addUser\"/>
198      <wsdl:input>
199        <soap:body use=\"literal\"/>
200      </wsdl:input>
201      <wsdl:output>
202        <soap:body use=\"literal\"/>
203      </wsdl:output>
204    </operation>
205   
206    <operation name=\"connect\">
207      <soap:operation soapAction=\"connect\"/>
208      <wsdl:input>
209        <soap:body use=\"literal\"/>
210      </wsdl:input>
211      <wsdl:output>
212        <soap:body use=\"literal\"/>
213      </wsdl:output>
214    </operation>
215   
216    <operation name=\"disconnect\">
217      <soap:operation soapAction=\"disconnect\"/>
218      <wsdl:input>
219        <soap:body use=\"literal\"/>
220      </wsdl:input>
221      <wsdl:output>
222        <soap:body use=\"literal\"/>
223      </wsdl:output>
224    </operation>
225   
226    <operation name=\"reqAuthorisation\">
227      <soap:operation soapAction=\"reqAuthorisation\"/>
228      <wsdl:input>
229        <soap:body use=\"literal\"/>
230      </wsdl:input>
231      <wsdl:output>
232        <soap:body use=\"literal\"/>
233      </wsdl:output>
234    </operation>
235
236    <operation name=\"getX509Cert\">
237      <soap:operation soapAction=\"getX509Cert\"/>
238      <wsdl:input>
239        <soap:body use=\"literal\"/>
240      </wsdl:input>
241      <wsdl:output>
242        <soap:body use=\"literal\"/>
243      </wsdl:output>
244    </operation>   
245 
246  </wsdl:binding>
247
248  <wsdl:service name=\"SessionMgrService\">
249    <wsdl:documentation>NERC Data Grid Session Manager web service</wsdl:documentation>
250    <wsdl:port binding=\"tns:SessionMgrBinding\" name=\"SessionMgr\">
251      <soap:address location=\"http://localhost:5000\"/>
252    </wsdl:port>
253  </wsdl:service>
254</wsdl:definitions>"""
255
256    def __init__(self, post='', **kw):
257        ServiceSOAPBinding.__init__(self, post)
258        if kw.has_key('impl'):
259            self.impl = kw['impl']
260        self.auth_method_name = None
261        if kw.has_key('auth_method_name'):
262            self.auth_method_name = kw['auth_method_name']
263    def authorize(self, auth_info, post, action):
264        if self.auth_method_name and hasattr(self.impl, self.auth_method_name):
265            return getattr(self.impl, self.auth_method_name)(auth_info, post, action)
266        else:
267            return 1
268
269    def soap_addUser(self, ps):
270        self.request = ps.Parse(addUserInputMsg.typecode)
271        parameters = (self.request._username, self.request._passPhrase)
272
273        # If we have an implementation object use it
274        if hasattr(self,'impl'):
275            parameters = self.impl.addUser(parameters[0],parameters[1])
276
277        result = addUserOutputMsg()
278        return self.request, result
279
280    soapAction['addUser'] = 'soap_addUser'
281    root[(addUserInputMsg.typecode.nspname,addUserInputMsg.typecode.pname)] = 'soap_addUser'
282
283    def soap_connect(self, ps):
284        self.request = ps.Parse(connectInputMsg.typecode)
285        parameters = (self.request._username, self.request._passPhrase, self.request._createServerSess, self.request._getCookie)
286
287        # If we have an implementation object use it
288        if hasattr(self,'impl'):
289            parameters = self.impl.connect(parameters[0],parameters[1],parameters[2],parameters[3])
290
291        result = connectOutputMsg()
292        # If we have an implementation object, copy the result
293        if hasattr(self,'impl'):
294            # Should have a tuple of 2 args
295            result._cookie = parameters[0]
296            result._proxyCert = parameters[1]
297        return self.request, result
298
299    soapAction['connect'] = 'soap_connect'
300    root[(connectInputMsg.typecode.nspname,connectInputMsg.typecode.pname)] = 'soap_connect'
301
302    def soap_disconnect(self, ps):
303        self.request = ps.Parse(disconnectInputMsg.typecode)
304        parameters = (self.request._proxyCert, self.request._sessID, self.request._encrSessionMgrURI)
305
306        # If we have an implementation object use it
307        if hasattr(self,'impl'):
308            parameters = self.impl.disconnect(parameters[0],parameters[1],parameters[2])
309
310        result = disconnectOutputMsg()
311        return self.request, result
312
313    soapAction['disconnect'] = 'soap_disconnect'
314    root[(disconnectInputMsg.typecode.nspname,disconnectInputMsg.typecode.pname)] = 'soap_disconnect'
315
316    def soap_reqAuthorisation(self, ps):
317        self.request = ps.Parse(reqAuthorisationInputMsg.typecode)
318        parameters = (self.request._proxyCert, self.request._sessID, self.request._encrSessionMgrURI, self.request._attAuthorityURI, self.request._attAuthorityCert, self.request._reqRole, self.request._mapFromTrustedHosts, self.request._rtnExtAttCertList, self.request._extAttCert, self.request._extTrustedHost)
319
320        # If we have an implementation object use it
321        if hasattr(self,'impl'):
322            parameters = self.impl.reqAuthorisation(parameters[0],parameters[1],parameters[2],parameters[3],parameters[4],parameters[5],parameters[6],parameters[7],parameters[8],parameters[9])
323
324        result = reqAuthorisationOutputMsg()
325        # If we have an implementation object, copy the result
326        if hasattr(self,'impl'):
327            # Should have a tuple of 3 args
328            result._attCert = parameters[0]
329            result._statusCode = parameters[1]
330            result._extAttCert = parameters[2]
331        return self.request, result
332
333    soapAction['reqAuthorisation'] = 'soap_reqAuthorisation'
334    root[(reqAuthorisationInputMsg.typecode.nspname,reqAuthorisationInputMsg.typecode.pname)] = 'soap_reqAuthorisation'
335
336    def soap_getX509Cert(self, ps):
337        self.request = ps.Parse(getX509CertInputMsg.typecode)
338
339        # If we have an implementation object use it
340        if hasattr(self,'impl'):
341            parameters = self.impl.getX509Cert()
342
343        result = getX509CertOutputMsg()
344        # If we have an implementation object, copy the result
345        if hasattr(self,'impl'):
346            result._x509Cert = parameters
347        return self.request, result
348
349    soapAction['getX509Cert'] = 'soap_getX509Cert'
350    root[(getX509CertInputMsg.typecode.nspname,getX509CertInputMsg.typecode.pname)] = 'soap_getX509Cert'
351
Note: See TracBrowser for help on using the repository browser.