Ignore:
Timestamp:
31/08/06 16:59:57 (13 years ago)
Author:
pjkersha
Message:

Working version with signature and validation across a SOAP interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/Tests/xmlsec/WS-Security/wsInterface.py

    r1461 r1469  
     1"""WS-Security test SOAP interface definitions 
     2 
     3NERC Data Grid Project 
     4 
     5P J Kershaw 01/09/06 
     6 
     7Copyright (C) 2006 CCLRC & NERC 
     8 
     9This software may be distributed under the terms of the Q Public License, 
     10version 1.0 or later. 
     11""" 
     12 
     13reposID = '$Id$' 
     14 
    115import ZSI 
    216from ZSI import dispatch, TCcompound, TC 
    317from ZSI.TC import TypeDefinition, ElementDeclaration 
    418from ZSI.generate.pyclass import pyclass_type 
     19 
    520 
    621class echoRequest(TCcompound.Struct):  
     
    5873    def __init__( self, name=None, ns=None, **kw ): 
    5974        echoResponse.__init__(self, name='echoResponse', ns='urn:echoServer') 
    60  
    61  
    62 class SecurityHeaderType_Def(ZSI.TCcompound.ComplexType, TypeDefinition): 
    63     schema = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
    64     type = (schema, "SecurityHeaderType") 
    65     def __init__(self, pname, ofwhat=(), attributes=None, extend=False, restrict=False, **kw): 
    66         ns = SecurityHeaderType_Def.schema 
    67         TClist = [ZSI.TC.AnyElement(aname="_any", minOccurs=0, maxOccurs="unbounded", nillable=False, processContents="lax")] 
    68         self.attribute_typecode_dict = attributes or {} 
    69         if extend: TClist += ofwhat 
    70         if restrict: TClist = ofwhat 
    71         else: 
    72             # attribute handling code 
    73             self.attribute_typecode_dict[("http://www.w3.org/2001/XMLSchema","anyAttribute")] = ZSI.TC.AnyElement() 
    74         ZSI.TCcompound.ComplexType.__init__(self, None, TClist, pname=pname, inorder=0, **kw) 
    75         class Holder: 
    76             __metaclass__ = pyclass_type 
    77             typecode = self 
    78             def __init__(self): 
    79                 # pyclass 
    80                 self._None = [] 
    81                 return 
    82         Holder.__name__ = "SecurityHeaderType_Holder" 
    83         self.pyclass = Holder 
    84  
    85  
    86 class Security_Dec(ElementDeclaration): 
    87     literal = "Security" 
    88     schema = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
    89     def __init__(self, **kw): 
    90         kw["pname"] = ("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","Security") 
    91         kw["aname"] = "_Security" 
    92         if SecurityHeaderType_Def not in Security_Dec.__bases__: 
    93             bases = list(Security_Dec.__bases__) 
    94             bases.insert(0, SecurityHeaderType_Def) 
    95             Security_Dec.__bases__ = tuple(bases) 
    96  
    97         SecurityHeaderType_Def.__init__(self, **kw) 
    98         if self.pyclass is not None: self.pyclass.__name__ = "Security_Dec_Holder" 
    99              
    100 class AttributedString_Def(TC.String, TypeDefinition): 
    101     # ComplexType/SimpleContent derivation of built-in type 
    102     schema = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
    103     type = (schema, "AttributedString") 
    104     def __init__(self, pname, **kw): 
    105         if getattr(self, "attribute_typecode_dict", None) is None: self.attribute_typecode_dict = {} 
    106         # attribute handling code 
    107         self.attribute_typecode_dict[("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd","Id")] = TC.AnyType() 
    108         self.attribute_typecode_dict[("http://www.w3.org/2001/XMLSchema","anyAttribute")] = TC.AnyElement() 
    109         TC.String.__init__(self, pname, **kw) 
    110         class Holder(str): 
    111             __metaclass__ = pyclass_type 
    112             typecode = self 
    113         self.pyclass = Holder 
    114  
    115 class EncodedString_Def(TypeDefinition): 
    116     # ComplexType/SimpleContent derivation of user-defined type 
    117     schema = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
    118     type = (schema, "EncodedString") 
    119     def __init__(self, pname, **kw): 
    120         ns = EncodedString_Def.schema 
    121         if AttributedString_Def not in EncodedString_Def.__bases__: 
    122             bases = list(EncodedString_Def.__bases__) 
    123             bases.insert(0, AttributedString_Def) 
    124             EncodedString_Def.__bases__ = tuple(bases) 
    125  
    126         if getattr(self, "attribute_typecode_dict", None) is None: self.attribute_typecode_dict = {} 
    127         # attribute handling code 
    128         self.attribute_typecode_dict["EncodingType"] = TC.URI() 
    129         AttributedString_Def.__init__(self, pname, **kw) 
    130  
    131  
    132 class BinarySecurityTokenType_Def(TypeDefinition): 
    133     # ComplexType/SimpleContent derivation of user-defined type 
    134     schema = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
    135     type = (schema, "BinarySecurityTokenType") 
    136     def __init__(self, pname, **kw): 
    137         ns = BinarySecurityTokenType_Def.schema 
    138         if EncodedString_Def not in BinarySecurityTokenType_Def.__bases__: 
    139             bases = list(BinarySecurityTokenType_Def.__bases__) 
    140             bases.insert(0, EncodedString_Def) 
    141             BinarySecurityTokenType_Def.__bases__ = tuple(bases) 
    142  
    143         if getattr(self, "attribute_typecode_dict", None) is None: self.attribute_typecode_dict = {} 
    144         # attribute handling code 
    145         self.attribute_typecode_dict["ValueType"] = TC.URI() 
    146         EncodedString_Def.__init__(self, pname, **kw) 
    147          
    148 class BinarySecurityToken_Dec(ElementDeclaration): 
    149     literal = "BinarySecurityToken" 
    150     schema = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
    151     def __init__(self, **kw): 
    152         kw["pname"] = ("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","BinarySecurityToken") 
    153         kw["aname"] = "_BinarySecurityToken" 
    154         if BinarySecurityTokenType_Def not in BinarySecurityToken_Dec.__bases__: 
    155             bases = list(BinarySecurityToken_Dec.__bases__) 
    156             bases.insert(0, BinarySecurityTokenType_Def) 
    157             BinarySecurityToken_Dec.__bases__ = tuple(bases) 
    158  
    159         BinarySecurityTokenType_Def.__init__(self, **kw) 
    160         if self.pyclass is not None: self.pyclass.__name__ = "BinarySecurityToken_Dec_Holder" 
Note: See TracChangeset for help on using the changeset viewer.