source: TI12-security/trunk/NDGSecurity/python/Tests/dewsGatekeeper/gatekeeperServer.py @ 7080

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/Tests/dewsGatekeeper/gatekeeperServer.py@7080
Revision 7080, 1.9 KB checked in by pjkersha, 9 years ago (diff)
  • Property svn:executable set to *
  • Property svn:keywords set to Id
Line 
1#!/usr/bin/env python
2#
3# How to build an echo server using the extended code generation
4#
5
6import sys
7
8# Import the ZSI stuff you'd need no matter what
9from ZSI.ServiceContainer import ServiceContainer
10
11# This is a new method imported to show it's value
12from ZSI.ServiceContainer import GetSOAPContext
13
14# Import the generated Server Object
15from Gatekeeper_services_server import GatekeeperService
16
17# Create a Server implementation
18
19# This using a derived server instead
20class GatekeeperServIn(GatekeeperService):
21    def __init__(self, post='', **kw):
22       
23        GatekeeperService.__init__(self, post, **kw)
24       
25#       
26#       
27#    def sign(self, sw):
28#        '''\
29#        Overrides ServiceInterface class method to allow digital signature'''
30#        self.signatureHandler.sign(sw)
31#
32#       
33#    def verify(self, ps):
34#        '''\
35#        Overrides ServiceInterface class method to allow signature
36#        verification'''
37#        self.signatureHandler.verify(ps)
38       
39    def authorize(self, auth_info, post, action):
40        print "Authorizing INHERIT Gatekeeper"
41        ctx = GetSOAPContext()
42        print dir(ctx)
43        print "Container: ", ctx.connection
44        print "Parsed SOAP: ", ctx.parsedsoap
45        print "Container: ", ctx.container
46        print "HTTP Headers:\n", ctx.httpheaders
47        print "----"
48        print "XML Data:\n", ctx.xmldata
49        return 1
50
51    def soap_get(self, ps, **kw):
52        #import pdb;pdb.set_trace()
53        response = GatekeeperService.soap_get(self, ps)
54        response._geoServerResponse = 'Geoserver Response'
55        return response
56
57
58# Here we set up the server
59serviceContainer = ServiceContainer(('localhost', 5000))
60
61# Create the Inherited version of the server
62Gatekeepersrv = GatekeeperServIn()
63serviceContainer.setNode(Gatekeepersrv, url="/GatekeeperServIn")
64
65# Run the service container
66try:
67    serviceContainer.serve_forever()
68except KeyboardInterrupt:
69    sys.exit(0)
Note: See TracBrowser for help on using the repository browser.