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

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

SessionMgr? SessionMgrClient? unit tests complete with tests for getSessionStatus included

ndg.security.server/ndg/security/server/conf/sessionMgr.tac:

  • code for getSessionStatus incorporated

ndg.security.server/ndg/security/server/SessionMgr/SessionMgr_services_server.py,
ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services.py,
ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services_types.py,
www/html/sessionMgr.wsdl: fixed getSessionStatusResponse - isAlive element needs to be nested within a sequence elem.

ndg.security.test/ndg/security/test/sessionMgrClient/SessionMgrClientTest.py,

ndg.security.test/ndg/security/test/sessionMgrClient/sessionMgrProperties.xml: default to https for tests

ndg.security.test/ndg/security/test/sessionMgrClient/sessionMgrClientTest.cfg: get rid of test1AddUser and added test2GetSessionStatus

ndg.security.test/ndg/security/test/sessionMgr/test.py: SessionMgr? unit tests all working

ndg.security.common/ndg/security/common/SessionMgr/init.py: added getSessionStatus method

ndg.security.common/ndg/security/common/AttAuthority/init.py: fix to getHostInfo - return dict indexed by hostname

ndg.security.common/ndg/security/common/AttAuthority/AttAuthority_services.py: re-ran code generation from WSDL

Makefile: added targets for building ZSI code stubs from AA and SM WSDLs.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
RevLine 
[452]1##################################################
[1749]2# SessionMgr_services.py
3# generated by ZSI.generate.wsdl2python
[452]4##################################################
5
6
[1749]7from SessionMgr_services_types import *
[452]8import urlparse, types
[1749]9from ZSI.TCcompound import ComplexType, Struct
[452]10from ZSI import client
11import ZSI
[1749]12from ZSI.generate.pyclass import pyclass_type
[452]13
[1749]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)
[452]21
[1749]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
[452]30
[3044]31    # op: <ZSI.wstools.WSDLTools.Message instance at 0x407737ec>
[3024]32    def getSessionStatus(self, userDN,sessID):
[452]33
[3024]34        request = getSessionStatusInputMsg()
35        request._userDN = userDN
36        request._sessID = sessID
[452]37
[1749]38        kw = {}
39        # no input wsaction
[3024]40        self.binding.Send(None, None, request, soapaction="getSessionStatus", **kw)
[1749]41        # no output wsaction
[3024]42        response = self.binding.Receive(getSessionStatusOutputMsg.typecode)
[3044]43        isAlive = response._isAlive
44        return isAlive
[452]45
[3044]46    # op: <ZSI.wstools.WSDLTools.Message instance at 0x40773c4c>
[2620]47    def connect(self, username,passphrase,createServerSess):
[452]48
[1749]49        request = connectInputMsg()
50        request._username = username
[2063]51        request._passphrase = passphrase
[1773]52        request._createServerSess = createServerSess
[452]53
[460]54        kw = {}
[1749]55        # no input wsaction
56        self.binding.Send(None, None, request, soapaction="connect", **kw)
57        # no output wsaction
58        response = self.binding.Receive(connectOutputMsg.typecode)
[2063]59        proxyCert = response._proxyCert
60        proxyPriKey = response._proxyPriKey
61        userCert = response._userCert
[2620]62        sessID = response._sessID
63        return proxyCert,proxyPriKey,userCert,sessID
[460]64
[3044]65    # op: <ZSI.wstools.WSDLTools.Message instance at 0x40778a8c>
[2620]66    def disconnect(self, userCert,sessID):
[460]67
[1749]68        request = disconnectInputMsg()
[2620]69        request._userCert = userCert
[1783]70        request._sessID = sessID
[452]71
72        kw = {}
[1749]73        # no input wsaction
74        self.binding.Send(None, None, request, soapaction="disconnect", **kw)
75        # no output wsaction
76        response = self.binding.Receive(disconnectOutputMsg.typecode)
77        return 
[452]78
[3044]79    # op: <ZSI.wstools.WSDLTools.Message instance at 0x40778c2c>
[2620]80    def getAttCert(self, userCert,sessID,attAuthorityURI,attAuthorityCert,reqRole,mapFromTrustedHosts,rtnExtAttCertList,extAttCert,extTrustedHost):
[452]81
[2058]82        request = getAttCertInputMsg()
[2063]83        request._userCert = userCert
[1773]84        request._sessID = sessID
85        request._attAuthorityURI = attAuthorityURI
86        request._attAuthorityCert = attAuthorityCert
87        request._reqRole = reqRole
88        request._mapFromTrustedHosts = mapFromTrustedHosts
89        request._rtnExtAttCertList = rtnExtAttCertList
[1777]90        request._extAttCert = extAttCert
91        request._extTrustedHost = extTrustedHost
[739]92
93        kw = {}
[1749]94        # no input wsaction
[2058]95        self.binding.Send(None, None, request, soapaction="getAttCert", **kw)
[1749]96        # no output wsaction
[2058]97        response = self.binding.Receive(getAttCertOutputMsg.typecode)
[1749]98        attCert = response._attCert
[2076]99        msg = response._msg
[2108]100        extAttCertOut = response._extAttCertOut
101        return attCert,msg,extAttCertOut
[739]102
[3044]103    # op: <ZSI.wstools.WSDLTools.Message instance at 0x40778dac>
[1773]104    def getX509Cert(self):
[739]105
[1773]106        request = getX509CertInputMsg()
[452]107
[533]108        kw = {}
[1749]109        # no input wsaction
[1773]110        self.binding.Send(None, None, request, soapaction="getX509Cert", **kw)
[1749]111        # no output wsaction
[1773]112        response = self.binding.Receive(getX509CertOutputMsg.typecode)
[1749]113        x509Cert = response._x509Cert
114        return x509Cert
[533]115
[3024]116getSessionStatusInputMsg = ns0.getSessionStatus_Dec().pyclass
[533]117
[3024]118getSessionStatusOutputMsg = ns0.getSessionStatusResponse_Dec().pyclass
[533]119
[1749]120connectInputMsg = ns0.connect_Dec().pyclass
[460]121
[1749]122connectOutputMsg = ns0.connectResponse_Dec().pyclass
[460]123
[1749]124disconnectInputMsg = ns0.disconnect_Dec().pyclass
[460]125
[1749]126disconnectOutputMsg = ns0.disconnectResponse_Dec().pyclass
[460]127
[2058]128getAttCertInputMsg = ns0.getAttCert_Dec().pyclass
[460]129
[2058]130getAttCertOutputMsg = ns0.getAttCertResponse_Dec().pyclass
[460]131
[1773]132getX509CertInputMsg = ns0.getX509Cert_Dec().pyclass
[460]133
[1773]134getX509CertOutputMsg = ns0.getX509CertResponse_Dec().pyclass
Note: See TracBrowser for help on using the repository browser.