Changeset 1749


Ignore:
Timestamp:
23/11/06 16:51:08 (13 years ago)
Author:
pjkersha
Message:

common/SessionMgr/*: wsdl2py generated SessionMgr? stubs + added init.py.
common/AttAuthority/init.py: added all to give default imports.

Location:
TI12-security/trunk/python/ndg.security.common/ndg/security/common
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.common/ndg/security/common/AttAuthority/__init__.py

    r1730 r1749  
    2020version 1.0 or later. 
    2121""" 
     22__all__ = [ 
     23    'AttAuthority_services', 
     24    'AttAuthority_services_types', 
     25    ] 
     26 
    2227# Handling for public key retrieval 
    2328import tempfile 
  • TI12-security/trunk/python/ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services.py

    r1748 r1749  
    11##################################################  
    2 # sessionMgr_services.py  
    3 # generated by ZSI.wsdl2python  
    4 #  
    5 #  
     2# SessionMgr_services.py  
     3# generated by ZSI.generate.wsdl2python 
    64################################################## 
    75 
    86 
     7from SessionMgr_services_types import * 
    98import urlparse, types 
    10 from ZSI.TCcompound import Struct 
     9from ZSI.TCcompound import ComplexType, Struct 
    1110from ZSI import client 
    1211import ZSI 
     12from ZSI.generate.pyclass import pyclass_type 
    1313 
    14 class sessionMgrServiceInterface: 
    15     def getsessionMgr(self, portAddress=None, **kw): 
    16         raise NonImplementationError, "method not implemented" 
     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) 
    1721 
     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 
    1830 
    19 class sessionMgrServiceLocator(sessionMgrServiceInterface): 
    20     sessionMgr_address = "http://glue.badc.rl.ac.uk/sessionMgr" 
    21     def getsessionMgrAddress(self): 
    22         return sessionMgrServiceLocator.sessionMgr_address 
     31    # op: <ZSI.wstools.WSDLTools.Message instance at 0xb6f49b2c> 
     32    def addUser(self, username,passPhrase): 
    2333 
    24     def getsessionMgr(self, portAddress=None, **kw): 
    25         return sessionMgrBindingSOAP(portAddress or sessionMgrServiceLocator.sessionMgr_address, **kw) 
     34        request = addUserInputMsg() 
     35        request._username = username 
     36        request._passPhrase = passPhrase 
    2637 
     38        kw = {} 
     39        # no input wsaction 
     40        self.binding.Send(None, None, request, soapaction="addUser", **kw) 
     41        # no output wsaction 
     42        response = self.binding.Receive(addUserOutputMsg.typecode) 
     43        cookie = response._cookie 
     44        proxyCert = response._proxyCert 
     45        return cookie,proxyCert 
    2746 
    28 class sessionMgrBindingSOAP: 
     47    # op: <ZSI.wstools.WSDLTools.Message instance at 0xb6f49e4c> 
     48    def connect(self, username,passPhrase): 
    2949 
    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) 
     50        request = connectInputMsg() 
     51        request._username = username 
     52        request._passPhrase = passPhrase 
    3953 
     54        kw = {} 
     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) 
     59        cookie = response._cookie 
     60        proxyCert = response._proxyCert 
     61        return cookie,proxyCert 
    4062 
    41     def addUser(self, request): 
    42         """ 
    43         @param: request to addUserRequest:: 
    44           _addUserReq: str 
     63    # op: <ZSI.wstools.WSDLTools.Message instance at 0xb6f5080c> 
     64    def disconnect(self, cookie,proxyCert): 
    4565 
    46         @return: response from addUserResponse:: 
    47           _addUserResp: str 
    48         """ 
     66        request = disconnectInputMsg() 
     67        request._cookie = cookie 
     68        request._proxyCert = proxyCert 
    4969 
    50         if not isinstance(request, addUserRequest) and\ 
    51             not issubclass(addUserRequest, request.__class__): 
    52             raise TypeError, "%s incorrect request type" %(request.__class__) 
    5370        kw = {} 
    54         response = self.binding.Send(None, None, request, soapaction="urn:sessionMgr#addUser", **kw) 
    55         response = self.binding.Receive(addUserResponseWrapper()) 
    56         if not isinstance(response, addUserResponse) and\ 
    57             not issubclass(addUserResponse, response.__class__): 
    58             raise TypeError, "%s incorrect response type" %(response.__class__) 
    59         return response 
     71        # no input wsaction 
     72        self.binding.Send(None, None, request, soapaction="disconnect", **kw) 
     73        # no output wsaction 
     74        response = self.binding.Receive(disconnectOutputMsg.typecode) 
     75        return  
    6076 
     77    # op: <ZSI.wstools.WSDLTools.Message instance at 0xb6f509ac> 
     78    def reqAuthorisation(self, cookie,proxyCert): 
    6179 
    62     def connect(self, request): 
    63         """ 
    64         @param: request to connectRequest:: 
    65           _connectReq: str 
     80        request = reqAuthorisationInputMsg() 
     81        request._cookie = cookie 
     82        request._proxyCert = proxyCert 
    6683 
    67         @return: response from connectResponse:: 
    68           _connectResp: str 
    69         """ 
     84        kw = {} 
     85        # no input wsaction 
     86        self.binding.Send(None, None, request, soapaction="reqAuthorisation", **kw) 
     87        # no output wsaction 
     88        response = self.binding.Receive(reqAuthorisationOutputMsg.typecode) 
     89        attCert = response._attCert 
     90        return attCert 
    7091 
    71         if not isinstance(request, connectRequest) and\ 
    72             not issubclass(connectRequest, request.__class__): 
    73             raise TypeError, "%s incorrect request type" %(request.__class__) 
     92    # op: <ZSI.wstools.WSDLTools.Message instance at 0xb6f50b2c> 
     93    def getPubKey(self): 
     94 
     95        request = getPubKeyInputMsg() 
     96 
    7497        kw = {} 
    75         response = self.binding.Send(None, None, request, soapaction="urn:sessionMgr#connect", **kw) 
    76         response = self.binding.Receive(connectResponseWrapper()) 
    77         if not isinstance(response, connectResponse) and\ 
    78             not issubclass(connectResponse, response.__class__): 
    79             raise TypeError, "%s incorrect response type" %(response.__class__) 
    80         return response 
     98        # no input wsaction 
     99        self.binding.Send(None, None, request, soapaction="getPubKey", **kw) 
     100        # no output wsaction 
     101        response = self.binding.Receive(getPubKeyOutputMsg.typecode) 
     102        x509Cert = response._x509Cert 
     103        return x509Cert 
    81104 
     105addUserInputMsg = ns0.connect_Dec().pyclass 
    82106 
    83     def getPubKey(self, request): 
    84         """ 
    85         @param: request to pubKeyRequest:: 
    86           _pubKeyReq: str 
     107addUserOutputMsg = ns0.connectResponse_Dec().pyclass 
    87108 
    88         @return: response from pubKeyResponse:: 
    89           _pubKeyResp: str 
    90         """ 
     109connectInputMsg = ns0.connect_Dec().pyclass 
    91110 
    92         if not isinstance(request, pubKeyRequest) and\ 
    93             not issubclass(pubKeyRequest, request.__class__): 
    94             raise TypeError, "%s incorrect request type" %(request.__class__) 
    95         kw = {} 
    96         response = self.binding.Send(None, None, request, soapaction="urn:sessionMgr#getPubKey", **kw) 
    97         response = self.binding.Receive(pubKeyResponseWrapper()) 
    98         if not isinstance(response, pubKeyResponse) and\ 
    99             not issubclass(pubKeyResponse, response.__class__): 
    100             raise TypeError, "%s incorrect response type" %(response.__class__) 
    101         return response 
     111connectOutputMsg = ns0.connectResponse_Dec().pyclass 
    102112 
     113disconnectInputMsg = ns0.disconnect_Dec().pyclass 
    103114 
    104     def reqAuthorisation(self, request): 
    105         """ 
    106         @param: request to authorisationRequest:: 
    107           _authorisationReq: str 
     115disconnectOutputMsg = ns0.disconnectResponse_Dec().pyclass 
    108116 
    109         @return: response from authorisationResponse:: 
    110           _authorisationResp: str 
    111         """ 
     117reqAuthorisationInputMsg = ns0.reqAuthorisation_Dec().pyclass 
    112118 
    113         if not isinstance(request, authorisationRequest) and\ 
    114             not issubclass(authorisationRequest, request.__class__): 
    115             raise TypeError, "%s incorrect request type" %(request.__class__) 
    116         kw = {} 
    117         response = self.binding.Send(None, None, request, soapaction="urn:sessionMgr#reqAuthorisation", **kw) 
    118         response = self.binding.Receive(authorisationResponseWrapper()) 
    119         if not isinstance(response, authorisationResponse) and\ 
    120             not issubclass(authorisationResponse, response.__class__): 
    121             raise TypeError, "%s incorrect response type" %(response.__class__) 
    122         return response 
     119reqAuthorisationOutputMsg = ns0.reqAuthorisationResponse_Dec().pyclass 
    123120 
     121getPubKeyInputMsg = ns0.getPubKey_Dec().pyclass 
    124122 
    125  
    126 class addUserRequest (ZSI.TCcompound.Struct):  
    127     def __init__(self, name=None, ns=None): 
    128         self._addUserReq = None 
    129  
    130         oname = None 
    131         if name: 
    132             oname = name 
    133             if ns: 
    134                 oname += ' xmlns="%s"' % ns 
    135             ZSI.TC.Struct.__init__(self, addUserRequest, [ZSI.TC.String(pname="addUserReq",aname="_addUserReq",optional=1),], pname=name, aname="_%s" % name, oname=oname ) 
    136  
    137 class addUserRequestWrapper(addUserRequest): 
    138     """wrapper for rpc:encoded message""" 
    139  
    140     typecode = addUserRequest(name='addUser', ns='urn:sessionMgr') 
    141     def __init__( self, name=None, ns=None, **kw ): 
    142         addUserRequest.__init__( self, name='addUser', ns='urn:sessionMgr' ) 
    143  
    144 class addUserResponse (ZSI.TCcompound.Struct):  
    145     def __init__(self, name=None, ns=None): 
    146         self._addUserResp = None 
    147  
    148         oname = None 
    149         if name: 
    150             oname = name 
    151             if ns: 
    152                 oname += ' xmlns="%s"' % ns 
    153             ZSI.TC.Struct.__init__(self, addUserResponse, [ZSI.TC.String(pname="addUserResp",aname="_addUserResp",optional=1),], pname=name, aname="_%s" % name, oname=oname ) 
    154  
    155 class addUserResponseWrapper(addUserResponse): 
    156     """wrapper for rpc:encoded message""" 
    157  
    158     typecode = addUserResponse(name='addUserResponse', ns='urn:sessionMgr') 
    159     def __init__( self, name=None, ns=None, **kw ): 
    160         addUserResponse.__init__( self, name='addUserResponse', ns='urn:sessionMgr' ) 
    161  
    162 class authorisationRequest (ZSI.TCcompound.Struct):  
    163     def __init__(self, name=None, ns=None): 
    164         self._authorisationReq = None 
    165  
    166         oname = None 
    167         if name: 
    168             oname = name 
    169             if ns: 
    170                 oname += ' xmlns="%s"' % ns 
    171             ZSI.TC.Struct.__init__(self, authorisationRequest, [ZSI.TC.String(pname="authorisationReq",aname="_authorisationReq",optional=1),], pname=name, aname="_%s" % name, oname=oname ) 
    172  
    173 class authorisationRequestWrapper(authorisationRequest): 
    174     """wrapper for rpc:encoded message""" 
    175  
    176     typecode = authorisationRequest(name='reqAuthorisation', ns='urn:sessionMgr') 
    177     def __init__( self, name=None, ns=None, **kw ): 
    178         authorisationRequest.__init__( self, name='reqAuthorisation', ns='urn:sessionMgr' ) 
    179  
    180 class authorisationResponse (ZSI.TCcompound.Struct):  
    181     def __init__(self, name=None, ns=None): 
    182         self._authorisationResp = None 
    183  
    184         oname = None 
    185         if name: 
    186             oname = name 
    187             if ns: 
    188                 oname += ' xmlns="%s"' % ns 
    189             ZSI.TC.Struct.__init__(self, authorisationResponse, [ZSI.TC.String(pname="authorisationResp",aname="_authorisationResp",optional=1),], pname=name, aname="_%s" % name, oname=oname ) 
    190  
    191 class authorisationResponseWrapper(authorisationResponse): 
    192     """wrapper for rpc:encoded message""" 
    193  
    194     typecode = authorisationResponse(name='reqAuthorisationResponse', ns='urn:sessionMgr') 
    195     def __init__( self, name=None, ns=None, **kw ): 
    196         authorisationResponse.__init__( self, name='reqAuthorisationResponse', ns='urn:sessionMgr' ) 
    197  
    198 class connectRequest (ZSI.TCcompound.Struct):  
    199     def __init__(self, name=None, ns=None): 
    200         self._connectReq = None 
    201  
    202         oname = None 
    203         if name: 
    204             oname = name 
    205             if ns: 
    206                 oname += ' xmlns="%s"' % ns 
    207             ZSI.TC.Struct.__init__(self, connectRequest, [ZSI.TC.String(pname="connectReq",aname="_connectReq",optional=1),], pname=name, aname="_%s" % name, oname=oname ) 
    208  
    209 class connectRequestWrapper(connectRequest): 
    210     """wrapper for rpc:encoded message""" 
    211  
    212     typecode = connectRequest(name='connect', ns='urn:sessionMgr') 
    213     def __init__( self, name=None, ns=None, **kw ): 
    214         connectRequest.__init__( self, name='connect', ns='urn:sessionMgr' ) 
    215  
    216 class connectResponse (ZSI.TCcompound.Struct):  
    217     def __init__(self, name=None, ns=None): 
    218         self._connectResp = None 
    219  
    220         oname = None 
    221         if name: 
    222             oname = name 
    223             if ns: 
    224                 oname += ' xmlns="%s"' % ns 
    225             ZSI.TC.Struct.__init__(self, connectResponse, [ZSI.TC.String(pname="connectResp",aname="_connectResp",optional=1),], pname=name, aname="_%s" % name, oname=oname ) 
    226  
    227 class connectResponseWrapper(connectResponse): 
    228     """wrapper for rpc:encoded message""" 
    229  
    230     typecode = connectResponse(name='connectResponse', ns='urn:sessionMgr') 
    231     def __init__( self, name=None, ns=None, **kw ): 
    232         connectResponse.__init__( self, name='connectResponse', ns='urn:sessionMgr' ) 
    233  
    234 class pubKeyRequest (ZSI.TCcompound.Struct):  
    235     def __init__(self, name=None, ns=None): 
    236         self._pubKeyReq = None 
    237  
    238         oname = None 
    239         if name: 
    240             oname = name 
    241             if ns: 
    242                 oname += ' xmlns="%s"' % ns 
    243             ZSI.TC.Struct.__init__(self, pubKeyRequest, [ZSI.TC.String(pname="pubKeyReq",aname="_pubKeyReq",optional=1),], pname=name, aname="_%s" % name, oname=oname ) 
    244  
    245 class pubKeyRequestWrapper(pubKeyRequest): 
    246     """wrapper for rpc:encoded message""" 
    247  
    248     typecode = pubKeyRequest(name='getPubKey', ns='urn:sessionMgr') 
    249     def __init__( self, name=None, ns=None, **kw ): 
    250         pubKeyRequest.__init__( self, name='getPubKey', ns='urn:sessionMgr' ) 
    251  
    252 class pubKeyResponse (ZSI.TCcompound.Struct):  
    253     def __init__(self, name=None, ns=None): 
    254         self._pubKeyResp = None 
    255  
    256         oname = None 
    257         if name: 
    258             oname = name 
    259             if ns: 
    260                 oname += ' xmlns="%s"' % ns 
    261             ZSI.TC.Struct.__init__(self, pubKeyResponse, [ZSI.TC.String(pname="pubKeyResp",aname="_pubKeyResp",optional=1),], pname=name, aname="_%s" % name, oname=oname ) 
    262  
    263 class pubKeyResponseWrapper(pubKeyResponse): 
    264     """wrapper for rpc:encoded message""" 
    265  
    266     typecode = pubKeyResponse(name='getPubKeyResponse', ns='urn:sessionMgr') 
    267     def __init__( self, name=None, ns=None, **kw ): 
    268         pubKeyResponse.__init__( self, name='getPubKeyResponse', ns='urn:sessionMgr' ) 
     123getPubKeyOutputMsg = ns0.getPubKeyResponse_Dec().pyclass 
Note: See TracChangeset for help on using the changeset viewer.