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

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@4480
Revision 4480, 11.5 KB checked in by pjkersha, 11 years ago (diff)

Combined Services tests:

  • added capability for Session Manager to call a local Attribute Authority in the WSGI stack of the same Paste instance
  • SOAP client can specify that the Session Manager call a local Attribute Authority by setting AttAuthorityURI to nill in the web service call.
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=\"0\" name=\"attAuthorityURI\" type=\"xsd:string\"/>
75                    <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"reqRole\" type=\"xsd:string\"/>
76                    <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"mapFromTrustedHosts\" type=\"xsd:boolean\"/>
77                    <xsd:element maxOccurs=\"1\" minOccurs=\"1\" name=\"rtnExtAttCertList\" type=\"xsd:boolean\"/>
78                        <xsd:element maxOccurs=\"unbounded\" minOccurs=\"0\" name=\"extAttCert\" type=\"xsd:string\"/>
79                        <xsd:element maxOccurs=\"unbounded\" minOccurs=\"0\" name=\"extTrustedHost\" type=\"xsd:string\"/>
80                  </xsd:sequence>
81                </xsd:complexType>
82      </xsd:element>
83     
84      <xsd:element name=\"getAttCertResponse\">
85        <xsd:complexType>
86              <xsd:sequence>
87                <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"attCert\" type=\"xsd:string\"/>
88                <xsd:element maxOccurs=\"1\" minOccurs=\"0\" name=\"msg\" type=\"xsd:string\"/>
89                        <xsd:element maxOccurs=\"unbounded\" minOccurs=\"0\" name=\"extAttCertOut\" type=\"xsd:string\"/>
90              </xsd:sequence>
91            </xsd:complexType>
92      </xsd:element>
93
94    </xsd:schema>
95  </wsdl:types>
96 
97  <wsdl:message name=\"getSessionStatusInputMsg\">
98    <wsdl:part element=\"tns:getSessionStatus\" name=\"parameters\"/>
99  </wsdl:message>
100
101  <wsdl:message name=\"getSessionStatusOutputMsg\">
102    <wsdl:part element=\"tns:getSessionStatusResponse\" name=\"parameters\"/>
103  </wsdl:message>
104 
105  <wsdl:message name=\"connectInputMsg\">
106    <wsdl:part element=\"tns:connect\" name=\"parameters\"/>
107  </wsdl:message>
108
109  <wsdl:message name=\"connectOutputMsg\">
110    <wsdl:part element=\"tns:connectResponse\" name=\"parameters\"/>
111  </wsdl:message>
112 
113  <wsdl:message name=\"disconnectInputMsg\">
114    <wsdl:part element=\"tns:disconnect\" name=\"parameters\"/>
115  </wsdl:message>
116
117  <wsdl:message name=\"disconnectOutputMsg\">
118    <wsdl:part element=\"tns:disconnectResponse\" name=\"parameters\"/>
119  </wsdl:message>
120
121  <wsdl:message name=\"getAttCertInputMsg\">
122    <wsdl:part element=\"tns:getAttCert\" name=\"parameters\"/>
123  </wsdl:message>
124
125  <wsdl:message name=\"getAttCertOutputMsg\">
126    <wsdl:part element=\"tns:getAttCertResponse\" name=\"parameters\"/>
127  </wsdl:message>
128
129  <wsdl:portType name=\"SessionManager\">
130    <wsdl:operation name=\"getSessionStatus\">
131      <wsdl:input message=\"tns:getSessionStatusInputMsg\"/>
132      <wsdl:output message=\"tns:getSessionStatusOutputMsg\"/>
133    </wsdl:operation>
134
135    <wsdl:operation name=\"connect\">
136      <wsdl:input message=\"tns:connectInputMsg\"/>
137      <wsdl:output message=\"tns:connectOutputMsg\"/>
138    </wsdl:operation>
139
140    <wsdl:operation name=\"disconnect\">
141      <wsdl:input message=\"tns:disconnectInputMsg\"/>
142      <wsdl:output message=\"tns:disconnectOutputMsg\"/>
143    </wsdl:operation>
144
145    <wsdl:operation name=\"getAttCert\">
146      <wsdl:input message=\"tns:getAttCertInputMsg\"/>
147      <wsdl:output message=\"tns:getAttCertOutputMsg\"/>
148    </wsdl:operation>
149  </wsdl:portType> 
150 
151  <wsdl:binding name=\"SessionManagerBinding\" type=\"tns:SessionManager\">
152    <soap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>
153
154    <wsdl:operation name=\"getSessionStatus\">
155      <soap:operation soapAction=\"getSessionStatus\"/>
156      <wsdl:input>
157        <soap:body use=\"literal\"/>
158      </wsdl:input>
159      <wsdl:output>
160        <soap:body use=\"literal\"/>
161      </wsdl:output>
162    </wsdl:operation>
163   
164    <wsdl:operation name=\"connect\">
165      <soap:operation soapAction=\"connect\"/>
166      <wsdl:input>
167        <soap:body use=\"literal\"/>
168      </wsdl:input>
169      <wsdl:output>
170        <soap:body use=\"literal\"/>
171      </wsdl:output>
172    </wsdl:operation>
173   
174    <wsdl:operation name=\"disconnect\">
175      <soap:operation soapAction=\"disconnect\"/>
176      <wsdl:input>
177        <soap:body use=\"literal\"/>
178      </wsdl:input>
179      <wsdl:output>
180        <soap:body use=\"literal\"/>
181      </wsdl:output>
182    </wsdl:operation>
183   
184    <wsdl:operation name=\"getAttCert\">
185      <soap:operation soapAction=\"getAttCert\"/>
186      <wsdl:input>
187        <soap:body use=\"literal\"/>
188      </wsdl:input>
189      <wsdl:output>
190        <soap:body use=\"literal\"/>
191      </wsdl:output>
192    </wsdl:operation>
193 
194  </wsdl:binding>
195
196  <wsdl:service name=\"SessionManagerService\">
197    <wsdl:documentation>NERC Data Grid Session Manager web service</wsdl:documentation>
198    <wsdl:port binding=\"tns:SessionManagerBinding\" name=\"SessionManager\">
199      <soap:address location=\"http://localhost:5000\"/>
200    </wsdl:port>
201  </wsdl:service>
202</wsdl:definitions>"""
203
204    def __init__(self, post='', **kw):
205        ServiceSOAPBinding.__init__(self, post)
206        if kw.has_key('impl'):
207            self.impl = kw['impl']
208        self.auth_method_name = None
209        if kw.has_key('auth_method_name'):
210            self.auth_method_name = kw['auth_method_name']
211    def authorize(self, auth_info, post, action):
212        if self.auth_method_name and hasattr(self.impl, self.auth_method_name):
213            return getattr(self.impl, self.auth_method_name)(auth_info, post, action)
214        else:
215            return 1
216
217    def soap_getSessionStatus(self, ps):
218        self.request = ps.Parse(getSessionStatusInputMsg.typecode)
219        parameters = (self.request._userDN, self.request._sessID)
220
221        # If we have an implementation object use it
222        if hasattr(self,'impl'):
223            parameters = self.impl.getSessionStatus(parameters[0],parameters[1])
224
225        result = getSessionStatusOutputMsg()
226        # If we have an implementation object, copy the result
227        if hasattr(self,'impl'):
228            result._isAlive = parameters
229        return result
230
231    soapAction['getSessionStatus'] = 'soap_getSessionStatus'
232    root[(getSessionStatusInputMsg.typecode.nspname,getSessionStatusInputMsg.typecode.pname)] = 'soap_getSessionStatus'
233
234    def soap_connect(self, ps):
235        self.request = ps.Parse(connectInputMsg.typecode)
236        parameters = (self.request._username, self.request._passphrase, self.request._createServerSess)
237
238        # If we have an implementation object use it
239        if hasattr(self,'impl'):
240            parameters = self.impl.connect(parameters[0],parameters[1],parameters[2])
241
242        result = connectOutputMsg()
243        # If we have an implementation object, copy the result
244        if hasattr(self,'impl'):
245            # Should have a tuple of 4 args
246            result._userX509Cert = parameters[0]
247            result._userPriKey = parameters[1]
248            result._issuingCert = parameters[2]
249            result._sessID = parameters[3]
250        return result
251
252    soapAction['connect'] = 'soap_connect'
253    root[(connectInputMsg.typecode.nspname,connectInputMsg.typecode.pname)] = 'soap_connect'
254
255    def soap_disconnect(self, ps):
256        self.request = ps.Parse(disconnectInputMsg.typecode)
257        parameters = (self.request._userX509Cert, self.request._sessID)
258
259        # If we have an implementation object use it
260        if hasattr(self,'impl'):
261            parameters = self.impl.disconnect(parameters[0],parameters[1])
262
263        result = disconnectOutputMsg()
264        return result
265
266    soapAction['disconnect'] = 'soap_disconnect'
267    root[(disconnectInputMsg.typecode.nspname,disconnectInputMsg.typecode.pname)] = 'soap_disconnect'
268
269    def soap_getAttCert(self, ps):
270        self.request = ps.Parse(getAttCertInputMsg.typecode)
271        parameters = (self.request._userX509Cert, self.request._sessID, self.request._attAuthorityURI, self.request._reqRole, self.request._mapFromTrustedHosts, self.request._rtnExtAttCertList, self.request._extAttCert, self.request._extTrustedHost)
272
273        # If we have an implementation object use it
274        if hasattr(self,'impl'):
275            parameters = self.impl.getAttCert(parameters[0],parameters[1],parameters[2],parameters[3],parameters[4],parameters[5],parameters[6],parameters[7])
276
277        result = getAttCertOutputMsg()
278        # If we have an implementation object, copy the result
279        if hasattr(self,'impl'):
280            # Should have a tuple of 3 args
281            result._attCert = parameters[0]
282            result._msg = parameters[1]
283            result._extAttCertOut = parameters[2]
284        return result
285
286    soapAction['getAttCert'] = 'soap_getAttCert'
287    root[(getAttCertInputMsg.typecode.nspname,getAttCertInputMsg.typecode.pname)] = 'soap_getAttCert'
288
Note: See TracBrowser for help on using the repository browser.