source: TI12-security/trunk/python/ndg.security.common/ndg/security/common/ca/simpleCA_services.py @ 2058

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

python/ndg.security.server/ndg/security/server/AttAuthority/server-config.tac:
update to file header.

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

  • setPropFilePath val input is now a keyword
  • readProperties - removed propFilePath keyword - set from propFilePath property /

setPropFilePath method instead.

python/ndg.security.server/ndg/security/server/AttAuthority/start-container.sh:
added standard header

python/ndg.security.server/ndg/security/server/SessionMgr/server-config.tac:

  • updated header
  • removed hard coded cert file paths
  • set port number from properties file instead.

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

  • change all refs to sessMgrWSDLuri -> sessMgrURI and encrSessMgrWSDLuri -> encrSessMgrURI. For ZSI 2.0, it's the URI of the service that is important. The URI of the WSDL is not required.
  • changed keyPPhrase property to keyPwd
  • added setPropFilePath and propFilePath property, added class variable to make up properties file path from $NDG_DIR.
  • removed propFilePath keyword from readProperties method - use setPropFilePath() / propFilePath property instead.
  • renamed reqAuthorisation method getAttCert to avoid confusion with authorisation function performed by Gatekeeper.

python/ndg.security.server/ndg/security/server/SessionMgr/start-container.sh: added
standard header

python/ndg.security.server/ndg/security/server/SessionMgr/Makefile: create server side
stubs calling wsdl2dispatch and sed to convert to correct imports and stub methods
return types for Twisted.

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,
python/ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services_types.py:

  • renamed reqAuthorisation operations to getAttCert to avoid confusion with authorisation performed by the Gatekeeper.

python/conf/sessionMgrProperties.xml: renamed property keyPPhrase -> keyPwd

python/ndg.security.client/ndg/security/client/ndgSessionClient.py: changed refs from
WSDL URI and URI for Session Manager address. For ZSI 2.0, the URI of service is needed
alone, not the WSLD address.

python/ndg.security.test/ndg/security/test/AttAuthority/siteAServer.sh,
python/ndg.security.test/ndg/security/test/AttAuthority/siteBServer.sh: updates to headers

python/ndg.security.test/ndg/security/test/AttAuthority/README and
python/ndg.security.test/ndg/security/test/SessionMgr/README: added to explain setup for
running services for clients to connect to.

python/ndg.security.test/ndg/security/test/SessionMgr/SessionMgrClientTest.py and
python/ndg.security.test/ndg/security/test/SessionMgr/sessionMgrClientTest.cfg:
refs to 'ReqAuthorisation?' changed to 'getAttCert' - see above.

python/ndg.security.test/ndg/security/test/SessionMgr/server.sh: script to start
Session Manager for client unit tests.

python/ndg.security.common/ndg/security/common/AttAuthority/README,
python/ndg.security.common/ndg/security/common/SessionMgr/README: include instruction to
use Makefile.

python/ndg.security.common/ndg/security/common/Log
python/ndg.security.common/ndg/security/common/Log/log_services_server.py
python/ndg.security.common/ndg/security/common/Log/log_services.py
python/ndg.security.common/ndg/security/common/ca/init.py
python/ndg.security.common/ndg/security/common/ca/simpleCA_services.py
python/ndg.security.common/ndg/security/common/ca/CertReq.py
python/ndg.security.common/ndg/security/common/Gatekeeper
python/ndg.security.common/ndg/security/common/Gatekeeper/TestGatekeeperResrc.py
python/ndg.security.common/ndg/security/common/Gatekeeper/Gatekeeper.py
python/ndg.security.common/ndg/security/common/Gatekeeper/gatekeeper_services.py
python/ndg.security.common/ndg/security/common/Gatekeeper/gatekeeper_services_server.py:
rearranged old Log and Gatekeeper service code into their own packages. Moved
CertReq?.py and simpleCA_services.py into ca package.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1##################################################
2# simpleCA_services.py
3# generated by ZSI.wsdl2python
4#
5#
6##################################################
7
8
9import urlparse, types
10from ZSI.TCcompound import Struct
11from ZSI import client
12import ZSI
13
14class simpleCAServiceInterface:
15    def getsimpleCA(self, portAddress=None, **kw):
16        raise NonImplementationError, "method not implemented"
17
18
19class simpleCAServiceLocator(simpleCAServiceInterface):
20    simpleCA_address = "http://127.0.0.1:5000/simpleCA.wsdl"
21    def getsimpleCAAddress(self):
22        return simpleCAServiceLocator.simpleCA_address
23
24    def getsimpleCA(self, portAddress=None, **kw):
25        return simpleCABindingSOAP(portAddress or simpleCAServiceLocator.simpleCA_address, **kw)
26
27
28class simpleCABindingSOAP:
29
30    def __init__(self, addr, **kw):
31        netloc = (urlparse.urlparse(addr)[1]).split(":") + [80,]
32        if not kw.has_key("host"):
33            kw["host"] = netloc[0]
34        if not kw.has_key("port"):
35            kw["port"] = int(netloc[1])
36        if not kw.has_key("url"):
37            kw["url"] =  urlparse.urlparse(addr)[2]
38        self.binding = client.Binding(**kw)
39
40
41    def reqCert(self, request):
42        """
43        @param: request to reqCertRequest::
44          _usrCertReq: str
45
46        @return: response from reqCertResponse::
47          _errMsg: str
48          _usrCert: str
49        """
50
51        if not isinstance(request, reqCertRequest) and\
52            not issubclass(reqCertRequest, request.__class__):
53            raise TypeError, "%s incorrect request type" %(request.__class__)
54        kw = {}
55        response = self.binding.Send(None, None, request, soapaction="urn:simpleCA#reqCert", **kw)
56        response = self.binding.Receive(reqCertResponseWrapper())
57        if not isinstance(response, reqCertResponse) and\
58            not issubclass(reqCertResponse, response.__class__):
59            raise TypeError, "%s incorrect response type" %(response.__class__)
60        return response
61
62
63
64class reqCertRequest (ZSI.TCcompound.Struct): 
65    def __init__(self, name=None, ns=None):
66        self._usrCertReq = None
67
68        oname = None
69        if name:
70            oname = name
71            if ns:
72                oname += ' xmlns="%s"' % ns
73            ZSI.TC.Struct.__init__(self, reqCertRequest, [ZSI.TC.String(pname="usrCertReq",aname="_usrCertReq",optional=1),], pname=name, aname="_%s" % name, oname=oname )
74
75class reqCertRequestWrapper(reqCertRequest):
76    """wrapper for rpc:encoded message"""
77
78    typecode = reqCertRequest(name='reqCert', ns='urn:simpleCA')
79    def __init__( self, name=None, ns=None, **kw ):
80        reqCertRequest.__init__( self, name='reqCert', ns='urn:simpleCA' )
81
82class reqCertResponse (ZSI.TCcompound.Struct): 
83    def __init__(self, name=None, ns=None):
84        self._usrCert = None
85        self._errMsg = None
86
87        oname = None
88        if name:
89            oname = name
90            if ns:
91                oname += ' xmlns="%s"' % ns
92            ZSI.TC.Struct.__init__(self, reqCertResponse, [ZSI.TC.String(pname="usrCert",aname="_usrCert",optional=1),ZSI.TC.String(pname="errMsg",aname="_errMsg",optional=1),], pname=name, aname="_%s" % name, oname=oname )
93
94class reqCertResponseWrapper(reqCertResponse):
95    """wrapper for rpc:encoded message"""
96
97    typecode = reqCertResponse(name='reqCertResponse', ns='urn:simpleCA')
98    def __init__( self, name=None, ns=None, **kw ):
99        reqCertResponse.__init__( self, name='reqCertResponse', ns='urn:simpleCA' )
Note: See TracBrowser for help on using the repository browser.