source: TI12-security/trunk/python/ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services.py @ 3024

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services.py@3024
Revision 3024, 4.5 KB checked in by pjkersha, 13 years ago (diff)

Adding getSessionStatus to enable SM clients to check a session is still valid.

python/ndg.security.server/ndg/security/server/SessionMgr/init.py:

  • new method getSessionStatus checks for a session's existence with given input sessID.

python/www/html/sessionMgr.wsdl,
python/ndg.security.server/ndg/security/server/SessionMgr/SessionMgr_services_server.py,
python/ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services.py:

  • added getSessionStatus operation to WSDL and regenerated the stubs

python/ndg.security.test/ndg/security/test/MyProxy/myProxyProperties.xml: replace refs to GLOBUS_LOCATION with NDGSEC_DIR for MyProxy? unit tests OpenSSL config file.

python/ndg.security.test/ndg/security/test/SessionMgr/SessionMgrTest.py: new unit test to test out ndg.security.server.SessionMgr?.SessionMgr? class. Previously, this required use of the SessionMgrClient? unit tests. ie. running over SOAP interface.

python/ndg.security.test/ndg/security/test/SessionMgr/sessionMgrProperties.xml,
python/ndg.security.test/ndg/security/test/SessionMgr/sessionMgrClientTest.cfg:

  • expt with settings to try twisted over http but run through proxy on 443 with Apache.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1##################################################
2# SessionMgr_services.py
3# generated by ZSI.generate.wsdl2python
4##################################################
5
6
7from SessionMgr_services_types import *
8import urlparse, types
9from ZSI.TCcompound import ComplexType, Struct
10from ZSI import client
11import ZSI
12from ZSI.generate.pyclass import pyclass_type
13
14# Locator
15class SessionMgrServiceLocator:
16    SessionMgr_address = "http://localhost:5000"
17    def getSessionMgrAddress(self):
18        return SessionMgrServiceLocator.SessionMgr_address
19    def getSessionMgr(self, url=None, **kw):
20        return SessionMgrBindingSOAP(url or SessionMgrServiceLocator.SessionMgr_address, **kw)
21
22# Methods
23class SessionMgrBindingSOAP:
24    def __init__(self, url, **kw):
25        kw.setdefault("readerclass", None)
26        kw.setdefault("writerclass", None)
27        # no resource properties
28        self.binding = client.Binding(url=url, **kw)
29        # no ws-addressing
30
31    # op: <ZSI.wstools.WSDLTools.Message instance at 0x4077376c>
32    def getSessionStatus(self, userDN,sessID):
33
34        request = getSessionStatusInputMsg()
35        request._userDN = userDN
36        request._sessID = sessID
37
38        kw = {}
39        # no input wsaction
40        self.binding.Send(None, None, request, soapaction="getSessionStatus", **kw)
41        # no output wsaction
42        response = self.binding.Receive(getSessionStatusOutputMsg.typecode)
43        return 
44
45    # op: <ZSI.wstools.WSDLTools.Message instance at 0x40773bcc>
46    def connect(self, username,passphrase,createServerSess):
47
48        request = connectInputMsg()
49        request._username = username
50        request._passphrase = passphrase
51        request._createServerSess = createServerSess
52
53        kw = {}
54        # no input wsaction
55        self.binding.Send(None, None, request, soapaction="connect", **kw)
56        # no output wsaction
57        response = self.binding.Receive(connectOutputMsg.typecode)
58        proxyCert = response._proxyCert
59        proxyPriKey = response._proxyPriKey
60        userCert = response._userCert
61        sessID = response._sessID
62        return proxyCert,proxyPriKey,userCert,sessID
63
64    # op: <ZSI.wstools.WSDLTools.Message instance at 0x4077898c>
65    def disconnect(self, userCert,sessID):
66
67        request = disconnectInputMsg()
68        request._userCert = userCert
69        request._sessID = sessID
70
71        kw = {}
72        # no input wsaction
73        self.binding.Send(None, None, request, soapaction="disconnect", **kw)
74        # no output wsaction
75        response = self.binding.Receive(disconnectOutputMsg.typecode)
76        return 
77
78    # op: <ZSI.wstools.WSDLTools.Message instance at 0x40778b2c>
79    def getAttCert(self, userCert,sessID,attAuthorityURI,attAuthorityCert,reqRole,mapFromTrustedHosts,rtnExtAttCertList,extAttCert,extTrustedHost):
80
81        request = getAttCertInputMsg()
82        request._userCert = userCert
83        request._sessID = sessID
84        request._attAuthorityURI = attAuthorityURI
85        request._attAuthorityCert = attAuthorityCert
86        request._reqRole = reqRole
87        request._mapFromTrustedHosts = mapFromTrustedHosts
88        request._rtnExtAttCertList = rtnExtAttCertList
89        request._extAttCert = extAttCert
90        request._extTrustedHost = extTrustedHost
91
92        kw = {}
93        # no input wsaction
94        self.binding.Send(None, None, request, soapaction="getAttCert", **kw)
95        # no output wsaction
96        response = self.binding.Receive(getAttCertOutputMsg.typecode)
97        attCert = response._attCert
98        msg = response._msg
99        extAttCertOut = response._extAttCertOut
100        return attCert,msg,extAttCertOut
101
102    # op: <ZSI.wstools.WSDLTools.Message instance at 0x40778cac>
103    def getX509Cert(self):
104
105        request = getX509CertInputMsg()
106
107        kw = {}
108        # no input wsaction
109        self.binding.Send(None, None, request, soapaction="getX509Cert", **kw)
110        # no output wsaction
111        response = self.binding.Receive(getX509CertOutputMsg.typecode)
112        x509Cert = response._x509Cert
113        return x509Cert
114
115getSessionStatusInputMsg = ns0.getSessionStatus_Dec().pyclass
116
117getSessionStatusOutputMsg = ns0.getSessionStatusResponse_Dec().pyclass
118
119connectInputMsg = ns0.connect_Dec().pyclass
120
121connectOutputMsg = ns0.connectResponse_Dec().pyclass
122
123disconnectInputMsg = ns0.disconnect_Dec().pyclass
124
125disconnectOutputMsg = ns0.disconnectResponse_Dec().pyclass
126
127getAttCertInputMsg = ns0.getAttCert_Dec().pyclass
128
129getAttCertOutputMsg = ns0.getAttCertResponse_Dec().pyclass
130
131getX509CertInputMsg = ns0.getX509Cert_Dec().pyclass
132
133getX509CertOutputMsg = ns0.getX509CertResponse_Dec().pyclass
Note: See TracBrowser for help on using the repository browser.