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

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

All Session Manager Client unit tests working with Session Manager service stub over https:

server/SessionMgr/server-config.tac
server/SessionMgr/SessionMgr_services_server.py
common/SessionMgr/SessionMgr_services.py
common/SessionMgr/SessionMgr_services_types.py
common/SessionMgr/init.py - added disconnect method to SessionMgrClient? class.

common/XMLSecDoc.py: comment out xmlsec for the moment. This module will need to be refactored
to use new digital signature code as used in WS-Security code tests.

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
26# Use for stub testing only
27from ndg.security.common.SessionCookie import SessionCookie
28from datetime import datetime, timedelta
29
30class SessionMgrServiceSub(SessionMgrService, WSResource):
31     def __init__(self):
32         WSResource.__init__(self)
33         
34         # Initialize Attribute Authority class
35         self.__sm = SessionMgr()
36
37     def soap_addUser(self, ps, **kw):
38         #import pdb;pdb.set_trace()
39         request, response = SessionMgrService.soap_addUser(self, ps)
40         return request, response
41
42     def soap_connect(self, ps, **kw):
43         #import pdb;pdb.set_trace()
44         request, response = SessionMgrService.soap_connect(self, ps)
45
46         if request.get_element_getCookie():
47             dtExpiry = datetime.utcnow() + timedelta(seconds=60*60)
48             cookie = SessionCookie(ndgID1='9'*64, 
49                                    ndgID2='0'*64,
50                                    dtExpiry=dtExpiry)
51             response.set_element_cookie(cookie)
52         else: 
53             response.set_element_proxyCert('PROXY CERT')
54                         
55         return request, response
56
57     def soap_disconnect(self, ps, **kw):
58         #import pdb;pdb.set_trace()
59         request, response = SessionMgrService.soap_disconnect(self, ps)
60         return request, response
61
62     def soap_reqAuthorisation(self, ps, **kw):
63         #import pdb;pdb.set_trace()
64         request, response = SessionMgrService.soap_reqAuthorisation(self, ps)
65         response.set_element_attCert('ATTRIBUTE CERTIFICATE')
66         response.set_element_statusCode('AcessGranted')
67         return request, response
68
69     def soap_getX509Cert(self, ps, **kw):
70         #import pdb;pdb.set_trace()
71         request, response = SessionMgrService.soap_getX509Cert(self, ps)
72         response.set_element_x509Cert('X.509 Cert.')
73         return request, response
74
75portNum = 5000
76hostname = socket.gethostname()
77
78root = Resource()
79root.putChild('SessionManager', SessionMgrServiceSub())
80siteFactory = Site(root)
81application = service.Application("ndgSecurityContainer")
82
83# Try SSL
84from twisted.internet import ssl
85kw = {}
86priKeyFilePath = '../../../../../Tests/Junk2-key.pem'
87certFilePath = '../../../../../Tests/Junk2-cert.pem'
88ctxFactory = ssl.DefaultOpenSSLContextFactory(priKeyFilePath, certFilePath)
89port = internet.SSLServer(portNum, siteFactory, ctxFactory)
90
91#port = internet.TCPServer(portNum, siteFactory)#, interface=hostname)
92port.setServiceParent(application)
Note: See TracBrowser for help on using the repository browser.