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

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@3044
Revision 3044, 13.2 KB checked in by pjkersha, 12 years ago (diff)

SessionMgr? SessionMgrClient? unit tests complete with tests for getSessionStatus included

ndg.security.server/ndg/security/server/conf/sessionMgr.tac:

  • code for getSessionStatus incorporated

ndg.security.server/ndg/security/server/SessionMgr/SessionMgr_services_server.py,
ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services.py,
ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services_types.py,
www/html/sessionMgr.wsdl: fixed getSessionStatusResponse - isAlive element needs to be nested within a sequence elem.

ndg.security.test/ndg/security/test/sessionMgrClient/SessionMgrClientTest.py,

ndg.security.test/ndg/security/test/sessionMgrClient/sessionMgrProperties.xml: default to https for tests

ndg.security.test/ndg/security/test/sessionMgrClient/sessionMgrClientTest.cfg: get rid of test1AddUser and added test2GetSessionStatus

ndg.security.test/ndg/security/test/sessionMgr/test.py: SessionMgr? unit tests all working

ndg.security.common/ndg/security/common/SessionMgr/init.py: added getSessionStatus method

ndg.security.common/ndg/security/common/AttAuthority/init.py: fix to getHostInfo - return dict indexed by hostname

ndg.security.common/ndg/security/common/AttAuthority/AttAuthority_services.py: re-ran code generation from WSDL

Makefile: added targets for building ZSI code stubs from AA and SM WSDLs.

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