source: TI12-security/trunk/python/ndg.security.server/ndg/security/server/AttAuthority/AttAuthority_services_server.py @ 1724

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.server/ndg/security/server/AttAuthority/AttAuthority_services_server.py@1724
Revision 1724, 8.4 KB checked in by pjkersha, 14 years ago (diff)

Setting up client, server and unit tests for Attribute Authority.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1##################################################
2# AttAuthority_services_server.py
3#      Generated by ZSI.generate.wsdl2dispatch.DelAuthServiceModuleWriter
4#
5##################################################
6
7from AttAuthority_services import *
8from ZSI.ServiceContainer import ServiceSOAPBinding
9
10class AttAuthorityService(ServiceSOAPBinding):
11    soapAction = {}
12    root = {}
13    _wsdl = """<?xml version=\"1.0\" ?>
14<wsdl:definitions name=\"AttAuthority\" 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=\"getAttCert\">
19        <xsd:complexType>
20          <xsd:sequence>
21            <xsd:element name=\"userCert\" type=\"xsd:string\"/>
22          </xsd:sequence>
23        </xsd:complexType>
24      </xsd:element>
25      <xsd:element name=\"getAttCertResponse\">
26        <xsd:complexType>
27          <xsd:sequence>
28            <xsd:element name=\"attCert\" type=\"xsd:string\"/>
29          </xsd:sequence>
30        </xsd:complexType>
31      </xsd:element>
32
33      <xsd:element name=\"getHostInfo\">
34        <xsd:complexType/>
35      </xsd:element>
36
37      <xsd:element name=\"getHostInfoResponse\">
38        <xsd:complexType/>
39      </xsd:element>
40
41      <xsd:element name=\"getTrustedHostInfo\">
42        <xsd:complexType>
43          <xsd:sequence>
44            <xsd:element name=\"role\" type=\"xsd:string\"/>
45          </xsd:sequence>
46        </xsd:complexType>
47      </xsd:element>
48      <xsd:element name=\"getTrustedHostInfoResponse\">
49        <xsd:complexType>
50          <xsd:sequence>
51            <xsd:element name=\"trustedHosts\" type=\"xsd:string\"/>
52          </xsd:sequence>
53        </xsd:complexType>
54      </xsd:element>
55
56      <xsd:element name=\"getPubKey\">
57        <xsd:complexType/>
58      </xsd:element>
59      <xsd:element name=\"getPubKeyResponse\">
60        <xsd:complexType>
61          <xsd:sequence>
62            <xsd:element name=\"x509Cert\" type=\"xsd:string\"/>
63          </xsd:sequence>
64        </xsd:complexType>
65      </xsd:element>
66
67    </xsd:schema>
68  </wsdl:types>
69 
70  <message name=\"getAttCertInputMsg\">
71    <part element=\"tns:getAttCert\" name=\"parameters\"/>
72  </message>
73
74  <message name=\"getAttCertOutputMsg\">
75    <part element=\"tns:getAttCertResponse\" name=\"parameters\"/>
76  </message>
77 
78  <message name=\"getHostInfoInputMsg\">
79    <part element=\"tns:getHostInfo\" name=\"parameters\"/>
80  </message>
81
82  <message name=\"getHostInfoOutputMsg\">
83    <part element=\"tns:getHostInfoResponse\" name=\"parameters\"/>
84  </message>
85
86  <message name=\"getTrustedHostInfoInputMsg\">
87    <part element=\"tns:getTrustedHostInfo\" name=\"parameters\"/>
88  </message>
89
90  <message name=\"getTrustedHostInfoOutputMsg\">
91    <part element=\"tns:getTrustedHostInfoResponse\" name=\"parameters\"/>
92  </message>
93
94  <message name=\"getPubKeyInputMsg\">
95    <part element=\"tns:getPubKey\" name=\"parameters\"/>
96  </message>
97
98  <message name=\"getPubKeyOutputMsg\">
99    <part element=\"tns:getPubKeyResponse\" name=\"parameters\"/>
100  </message>
101
102  <wsdl:portType name=\"AttAuthority\">
103    <wsdl:operation name=\"getAttCert\">
104      <wsdl:input message=\"tns:getAttCertInputMsg\"/>
105      <wsdl:output message=\"tns:getAttCertOutputMsg\"/>
106    </wsdl:operation>
107
108    <operation name=\"getHostInfo\">
109      <wsdl:input message=\"tns:getHostInfoInputMsg\"/>
110      <output message=\"tns:getHostInfoOutputMsg\"/>
111    </operation>
112
113    <operation name=\"getTrustedHostInfo\">
114      <wsdl:input message=\"tns:getTrustedHostInfoInputMsg\"/>
115      <output message=\"tns:getTrustedHostInfoOutputMsg\"/>
116    </operation>
117
118    <operation name=\"getPubKey\">
119      <wsdl:input message=\"tns:getPubKeyInputMsg\"/>
120      <output message=\"tns:getPubKeyOutputMsg\"/>
121    </operation>
122  </wsdl:portType>
123
124  <wsdl:binding name=\"AttAuthorityBinding\" type=\"tns:AttAuthority\">
125    <soap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>
126     
127    <wsdl:operation name=\"getAttCert\">
128      <soap:operation soapAction=\"getAttCert\"/>
129      <wsdl:input>
130        <soap:body use=\"literal\"/>
131      </wsdl:input>
132      <wsdl:output>
133        <soap:body use=\"literal\"/>
134      </wsdl:output>
135    </wsdl:operation>
136
137    <operation name=\"getHostInfo\">
138      <soap:operation soapAction=\"getHostInfo\"/>
139      <wsdl:input>
140        <soap:body use=\"literal\"/>
141      </wsdl:input>
142      <wsdl:output>
143        <soap:body use=\"literal\"/>
144      </wsdl:output>
145    </operation>
146
147    <operation name=\"getTrustedHostInfo\">
148      <soap:operation soapAction=\"getTrustedHostInfo\"/>
149      <wsdl:input>
150        <soap:body use=\"literal\"/>
151      </wsdl:input>
152      <wsdl:output>
153        <soap:body use=\"literal\"/>
154      </wsdl:output>
155    </operation>
156
157    <operation name=\"getPubKey\">
158      <soap:operation soapAction=\"getPubKey\"/>
159      <wsdl:input>
160        <soap:body use=\"literal\"/>
161      </wsdl:input>
162      <wsdl:output>
163        <soap:body use=\"literal\"/>
164      </wsdl:output>
165    </operation>   
166 
167  </wsdl:binding>
168
169  <wsdl:service name=\"AttAuthorityService\">
170    <wsdl:documentation>NERC Data Grid Attribute Authority web service</wsdl:documentation>
171    <wsdl:port binding=\"tns:AttAuthorityBinding\" name=\"SimpleCA\">
172      <soap:address location=\"http://localhost:5700\"/>
173    </wsdl:port>
174  </wsdl:service>
175</wsdl:definitions>"""
176
177    def __init__(self, post='', **kw):
178        ServiceSOAPBinding.__init__(self, post)
179        if kw.has_key('impl'):
180            self.impl = kw['impl']
181        self.auth_method_name = None
182        if kw.has_key('auth_method_name'):
183            self.auth_method_name = kw['auth_method_name']
184    def authorize(self, auth_info, post, action):
185        if self.auth_method_name and hasattr(self.impl, self.auth_method_name):
186            return getattr(self.impl, self.auth_method_name)(auth_info, post, action)
187        else:
188            return 1
189
190    def soap_getAttCert(self, ps):
191        self.request = ps.Parse(getAttCertInputMsg.typecode)
192        parameters = self.request._userCert
193
194        # If we have an implementation object use it
195        if hasattr(self,'impl'):
196            parameters = self.impl.getAttCert(parameters)
197
198        result = getAttCertOutputMsg()
199        # If we have an implementation object, copy the result
200        if hasattr(self,'impl'):
201            result._attCert = parameters
202        return self.request, result
203
204    soapAction['getAttCert'] = 'soap_getAttCert'
205    root[(getAttCertInputMsg.typecode.nspname,getAttCertInputMsg.typecode.pname)] = 'soap_getAttCert'
206
207    def soap_getHostInfo(self, ps):
208        self.request = ps.Parse(getHostInfoInputMsg.typecode)
209
210        # If we have an implementation object use it
211        if hasattr(self,'impl'):
212            parameters = self.impl.getHostInfo()
213
214        result = getHostInfoOutputMsg()
215        return self.request, result
216
217    soapAction['getHostInfo'] = 'soap_getHostInfo'
218    root[(getHostInfoInputMsg.typecode.nspname,getHostInfoInputMsg.typecode.pname)] = 'soap_getHostInfo'
219
220    def soap_getTrustedHostInfo(self, ps):
221        self.request = ps.Parse(getTrustedHostInfoInputMsg.typecode)
222        parameters = self.request._role
223
224        # If we have an implementation object use it
225        if hasattr(self,'impl'):
226            parameters = self.impl.getTrustedHostInfo(parameters)
227
228        result = getTrustedHostInfoOutputMsg()
229        # If we have an implementation object, copy the result
230        if hasattr(self,'impl'):
231            result._trustedHosts = parameters
232        return self.request, result
233
234    soapAction['getTrustedHostInfo'] = 'soap_getTrustedHostInfo'
235    root[(getTrustedHostInfoInputMsg.typecode.nspname,getTrustedHostInfoInputMsg.typecode.pname)] = 'soap_getTrustedHostInfo'
236
237    def soap_getPubKey(self, ps):
238        self.request = ps.Parse(getPubKeyInputMsg.typecode)
239
240        # If we have an implementation object use it
241        if hasattr(self,'impl'):
242            parameters = self.impl.getPubKey()
243
244        result = getPubKeyOutputMsg()
245        # If we have an implementation object, copy the result
246        if hasattr(self,'impl'):
247            result._x509Cert = parameters
248        return self.request, result
249
250    soapAction['getPubKey'] = 'soap_getPubKey'
251    root[(getPubKeyInputMsg.typecode.nspname,getPubKeyInputMsg.typecode.pname)] = 'soap_getPubKey'
252
Note: See TracBrowser for help on using the repository browser.