source: TI12-security/trunk/python/ndg.security.server/ndg/security/server/zsi/sessionmanager/SessionManager_services_server.py @ 4437

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.server/ndg/security/server/zsi/sessionmanager/SessionManager_services_server.py@4437
Revision 4437, 11.6 KB checked in by pjkersha, 12 years ago (diff)

Working Session Manager client unit tests for WSGI based Session Manager

  • removed getX509Cert operation from WSDL - no longer needed
  • fix to prefix keyword for ConfigFileParsers? ini file parsing.
Line 
1##################################################
2# SessionManager_services_server.py
3#      Generated by ZSI.generate.wsdl2dispatch.DelAuthServiceModuleWriter
4#
5##################################################
6
7from ndg.security.common.zsi.sessionmanager.SessionManager_services import *
8from ZSI.ServiceContainer import ServiceSOAPBinding
9
10class SessionManagerService(ServiceSOAPBinding):
11    soapAction = {}
12    root = {}
13    _wsdl = """<?xml version=\"1.0\" ?>
14<wsdl:definitions name=\"SessionManager\" targetNamespace=\"urn:ndg:security:SessionManager\" 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:SessionManager\" 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:SessionManager\">
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=\"0\" name=\"userX509Cert\" type=\"xsd:string\"/>
49                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"userPriKey\" type=\"xsd:string\"/>
50                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"issuingCert\" 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=\"userX509Cert\" 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=\"userX509Cert\" 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:schema>
96  </wsdl:types>
97 
98  <wsdl:message name=\"getSessionStatusInputMsg\">
99    <wsdl:part element=\"tns:getSessionStatus\" name=\"parameters\"/>
100  </wsdl:message>
101
102  <wsdl:message name=\"getSessionStatusOutputMsg\">
103    <wsdl:part element=\"tns:getSessionStatusResponse\" name=\"parameters\"/>
104  </wsdl:message>
105 
106  <wsdl:message name=\"connectInputMsg\">
107    <wsdl:part element=\"tns:connect\" name=\"parameters\"/>
108  </wsdl:message>
109
110  <wsdl:message name=\"connectOutputMsg\">
111    <wsdl:part element=\"tns:connectResponse\" name=\"parameters\"/>
112  </wsdl:message>
113 
114  <wsdl:message name=\"disconnectInputMsg\">
115    <wsdl:part element=\"tns:disconnect\" name=\"parameters\"/>
116  </wsdl:message>
117
118  <wsdl:message name=\"disconnectOutputMsg\">
119    <wsdl:part element=\"tns:disconnectResponse\" name=\"parameters\"/>
120  </wsdl:message>
121
122  <wsdl:message name=\"getAttCertInputMsg\">
123    <wsdl:part element=\"tns:getAttCert\" name=\"parameters\"/>
124  </wsdl:message>
125
126  <wsdl:message name=\"getAttCertOutputMsg\">
127    <wsdl:part element=\"tns:getAttCertResponse\" name=\"parameters\"/>
128  </wsdl:message>
129
130  <wsdl:portType name=\"SessionManager\">
131    <wsdl:operation name=\"getSessionStatus\">
132      <wsdl:input message=\"tns:getSessionStatusInputMsg\"/>
133      <wsdl:output message=\"tns:getSessionStatusOutputMsg\"/>
134    </wsdl:operation>
135
136    <wsdl:operation name=\"connect\">
137      <wsdl:input message=\"tns:connectInputMsg\"/>
138      <wsdl:output message=\"tns:connectOutputMsg\"/>
139    </wsdl:operation>
140
141    <wsdl:operation name=\"disconnect\">
142      <wsdl:input message=\"tns:disconnectInputMsg\"/>
143      <wsdl:output message=\"tns:disconnectOutputMsg\"/>
144    </wsdl:operation>
145
146    <wsdl:operation name=\"getAttCert\">
147      <wsdl:input message=\"tns:getAttCertInputMsg\"/>
148      <wsdl:output message=\"tns:getAttCertOutputMsg\"/>
149    </wsdl:operation>
150  </wsdl:portType> 
151 
152  <wsdl:binding name=\"SessionManagerBinding\" type=\"tns:SessionManager\">
153    <soap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>
154
155    <wsdl:operation name=\"getSessionStatus\">
156      <soap:operation soapAction=\"getSessionStatus\"/>
157      <wsdl:input>
158        <soap:body use=\"literal\"/>
159      </wsdl:input>
160      <wsdl:output>
161        <soap:body use=\"literal\"/>
162      </wsdl:output>
163    </wsdl:operation>
164   
165    <wsdl:operation name=\"connect\">
166      <soap:operation soapAction=\"connect\"/>
167      <wsdl:input>
168        <soap:body use=\"literal\"/>
169      </wsdl:input>
170      <wsdl:output>
171        <soap:body use=\"literal\"/>
172      </wsdl:output>
173    </wsdl:operation>
174   
175    <wsdl:operation name=\"disconnect\">
176      <soap:operation soapAction=\"disconnect\"/>
177      <wsdl:input>
178        <soap:body use=\"literal\"/>
179      </wsdl:input>
180      <wsdl:output>
181        <soap:body use=\"literal\"/>
182      </wsdl:output>
183    </wsdl:operation>
184   
185    <wsdl:operation name=\"getAttCert\">
186      <soap:operation soapAction=\"getAttCert\"/>
187      <wsdl:input>
188        <soap:body use=\"literal\"/>
189      </wsdl:input>
190      <wsdl:output>
191        <soap:body use=\"literal\"/>
192      </wsdl:output>
193    </wsdl:operation>
194 
195  </wsdl:binding>
196
197  <wsdl:service name=\"SessionManagerService\">
198    <wsdl:documentation>NERC Data Grid Session Manager web service</wsdl:documentation>
199    <wsdl:port binding=\"tns:SessionManagerBinding\" name=\"SessionManager\">
200      <soap:address location=\"http://localhost:5000\"/>
201    </wsdl:port>
202  </wsdl:service>
203</wsdl:definitions>"""
204
205    def __init__(self, post='', **kw):
206        ServiceSOAPBinding.__init__(self, post)
207        if kw.has_key('impl'):
208            self.impl = kw['impl']
209        self.auth_method_name = None
210        if kw.has_key('auth_method_name'):
211            self.auth_method_name = kw['auth_method_name']
212    def authorize(self, auth_info, post, action):
213        if self.auth_method_name and hasattr(self.impl, self.auth_method_name):
214            return getattr(self.impl, self.auth_method_name)(auth_info, post, action)
215        else:
216            return 1
217
218    def soap_getSessionStatus(self, ps):
219        self.request = ps.Parse(getSessionStatusInputMsg.typecode)
220        parameters = (self.request._userDN, self.request._sessID)
221
222        # If we have an implementation object use it
223        if hasattr(self,'impl'):
224            parameters = self.impl.getSessionStatus(parameters[0],parameters[1])
225
226        result = getSessionStatusOutputMsg()
227        # If we have an implementation object, copy the result
228        if hasattr(self,'impl'):
229            result._isAlive = parameters
230        return result
231
232    soapAction['getSessionStatus'] = 'soap_getSessionStatus'
233    root[(getSessionStatusInputMsg.typecode.nspname,getSessionStatusInputMsg.typecode.pname)] = 'soap_getSessionStatus'
234
235    def soap_connect(self, ps):
236        self.request = ps.Parse(connectInputMsg.typecode)
237        parameters = (self.request._username, self.request._passphrase, self.request._createServerSess)
238
239        # If we have an implementation object use it
240        if hasattr(self,'impl'):
241            parameters = self.impl.connect(parameters[0],parameters[1],parameters[2])
242
243        result = connectOutputMsg()
244        # If we have an implementation object, copy the result
245        if hasattr(self,'impl'):
246            # Should have a tuple of 4 args
247            result._userX509Cert = parameters[0]
248            result._userPriKey = parameters[1]
249            result._issuingCert = parameters[2]
250            result._sessID = parameters[3]
251        return result
252
253    soapAction['connect'] = 'soap_connect'
254    root[(connectInputMsg.typecode.nspname,connectInputMsg.typecode.pname)] = 'soap_connect'
255
256    def soap_disconnect(self, ps):
257        self.request = ps.Parse(disconnectInputMsg.typecode)
258        parameters = (self.request._userX509Cert, self.request._sessID)
259
260        # If we have an implementation object use it
261        if hasattr(self,'impl'):
262            parameters = self.impl.disconnect(parameters[0],parameters[1])
263
264        result = disconnectOutputMsg()
265        return result
266
267    soapAction['disconnect'] = 'soap_disconnect'
268    root[(disconnectInputMsg.typecode.nspname,disconnectInputMsg.typecode.pname)] = 'soap_disconnect'
269
270    def soap_getAttCert(self, ps):
271        self.request = ps.Parse(getAttCertInputMsg.typecode)
272        parameters = (self.request._userX509Cert, self.request._sessID, self.request._attAuthorityURI, self.request._attAuthorityCert, self.request._reqRole, self.request._mapFromTrustedHosts, self.request._rtnExtAttCertList, self.request._extAttCert, self.request._extTrustedHost)
273
274        # If we have an implementation object use it
275        if hasattr(self,'impl'):
276            parameters = self.impl.getAttCert(parameters[0],parameters[1],parameters[2],parameters[3],parameters[4],parameters[5],parameters[6],parameters[7],parameters[8])
277
278        result = getAttCertOutputMsg()
279        # If we have an implementation object, copy the result
280        if hasattr(self,'impl'):
281            # Should have a tuple of 3 args
282            result._attCert = parameters[0]
283            result._msg = parameters[1]
284            result._extAttCertOut = parameters[2]
285        return result
286
287    soapAction['getAttCert'] = 'soap_getAttCert'
288    root[(getAttCertInputMsg.typecode.nspname,getAttCertInputMsg.typecode.pname)] = 'soap_getAttCert'
289
Note: See TracBrowser for help on using the repository browser.