source: TI12-security/trunk/python/ndg.security.server/ndg/security/server/SessionMgr/server-config.tac @ 1777

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.server/ndg/security/server/SessionMgr/server-config.tac@1777
Revision 1777, 2.6 KB checked in by pjkersha, 13 years ago (diff)

Working version of Session Manager stubs with reqAuthorisation, connect and getX509Cert calls.

server/SessionMgr/server-config.tac: added stubs for reqAuthorisation - TODO: hook up *real* SessionMgr?
backend.
server/SessionMgr/SessionMgr_services_server.py, common/SessionMgr/SessionMgr_services.py,
common/SessionMgr/SessionMgr_services_types.py, www/html/sessionMgr.wsdl: changes to WSDL to support
reqAuthorisation operations including list elements (by setting maxOccurs="unbounded")

test/SessionMgrClientTest.py: Session Manager unit tests updated for the above.

test/SessionCookieTest.py: new unit test for SessionCookie? module.

common/SessionCookie.py: fixes including ability to pass a cookie string to initialise and create
a new object.

Line 
1#!/usr/bin/env python
2"""NDG Security Attribute Authority .tac file
3
4This file enables the Session Manager web service to be
5called under the Twisted framework
6
7NERC Data Grid Project
8
9P J Kershaw 23/11/06
10
11Copyright (C) 2006 CCLRC & NERC
12
13This software may be distributed under the terms of the Q Public License,
14version 1.0 or later.
15"""
16import socket
17
18from ZSI.twisted.WSresource import WSResource
19from twisted.application import service, internet
20from twisted.web.server import Site
21from twisted.web.resource import Resource
22
23from SessionMgr_services_server import SessionMgrService
24from ndg.security.server.SessionMgr import SessionMgr
25
26from ndg.security.common.SessionCookie import SessionCookie
27from datetime import datetime, timedelta
28
29class SessionMgrServiceSub(SessionMgrService, WSResource):
30     def __init__(self):
31         WSResource.__init__(self)
32         
33         # Initialize Attribute Authority class
34         self.__sm = SessionMgr()
35
36     def soap_addUser(self, ps, **kw):
37         #import pdb;pdb.set_trace()
38         request, response = SessionMgrService.soap_addUser(self, ps)
39         return request, response
40
41     def soap_connect(self, ps, **kw):
42         #import pdb;pdb.set_trace()
43         request, response = SessionMgrService.soap_connect(self, ps)
44         response.set_element_proxyCert('PROXY CERT')
45         
46         dtExpiry = datetime.utcnow() + timedelta(seconds=60*60)
47         cookie = SessionCookie(ndgID1='9'*64, 
48                                ndgID2='0'*64,
49                                dtExpiry=dtExpiry)
50         
51         response.set_element_cookie(cookie)
52         return request, response
53
54     def soap_disconnect(self, ps, **kw):
55         #import pdb;pdb.set_trace()
56         request, response = SessionMgrService.soap_disconnect(self, ps)
57         return request, response
58
59     def soap_reqAuthorisation(self, ps, **kw):
60         #import pdb;pdb.set_trace()
61         request, response = SessionMgrService.soap_reqAuthorisation(self, ps)
62         response.set_element_attCert('ATTRIBUTE CERTIFICATE')
63         response.set_element_statusCode('AcessGranted')
64         return request, response
65
66     def soap_getX509Cert(self, ps, **kw):
67         #import pdb;pdb.set_trace()
68         request, response = SessionMgrService.soap_getX509Cert(self, ps)
69         response.set_element_x509Cert('X.509 Cert.')
70         return request, response
71
72portNum = 5000
73hostname = socket.gethostname()
74
75root = Resource()
76root.putChild('SessionManager', SessionMgrServiceSub())
77siteFactory = Site(root)
78application = service.Application("ndgSecurityContainer")
79port = internet.TCPServer(portNum, siteFactory)#, interface=hostname)
80port.setServiceParent(application)
Note: See TracBrowser for help on using the repository browser.