Changeset 6900
- Timestamp:
- 28/05/10 10:56:21 (11 years ago)
- Location:
- TI12-security/trunk/ndg_saml
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/ndg_saml/ndg/__init__.py
r6607 r6900 14 14 __date__ = "23/02/2010" 15 15 __copyright__ = "(C) 2010 Science and Technology Facilities Council" 16 __license__ = " BSD - see LICENSE file in top-level directory"16 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 17 17 __contact__ = "Philip.Kershaw@stfc.ac.uk" 18 18 __revision__ = '$Id: $' -
TI12-security/trunk/ndg_saml/ndg/saml/__init__.py
r6069 r6900 24 24 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 25 25 __contact__ = "Philip.Kershaw@stfc.ac.uk" 26 __license__ = " BSD - see LICENSE file in top-level directory"26 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 27 27 __contact__ = "Philip.Kershaw@stfc.ac.uk" 28 __revision__ = "$Id :$"28 __revision__ = "$Id$" -
TI12-security/trunk/ndg_saml/ndg/saml/common/__init__.py
r6609 r6900 26 26 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 27 27 __contact__ = "Philip.Kershaw@stfc.ac.uk" 28 __license__ = " BSD - see LICENSE file in top-level directory"28 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 29 29 __contact__ = "Philip.Kershaw@stfc.ac.uk" 30 __revision__ = "$Id :$"30 __revision__ = "$Id$" 31 31 from ndg.saml.common.xml import SAMLConstants, QName 32 32 33 33 34 34 class SAMLObject(object): 35 """Base class for all SAML types""" 35 """Base class for all SAML types 36 37 @cvar DEFAULT_ELEMENT_LOCAL_NAME: default XML element name - derived classes 38 must specify 39 @type DEFAULT_ELEMENT_LOCAL_NAME: None 40 @ivar __qname: qualified name for XML element 41 @type __qname: ndg.saml.common.xml.QName 42 """ 36 43 DEFAULT_ELEMENT_LOCAL_NAME = None 37 44 __slots__ = ('__qname',) … … 41 48 elementLocalName=None, 42 49 namespacePrefix=SAMLConstants.SAML20_PREFIX): 43 '''@param namespaceURI: the namespace the element is in 50 ''' 51 @param namespaceURI: the namespace the element is in 52 @type namespaceURI: basestring 44 53 @param elementLocalName: the local name of the XML element this Object 45 represents 54 represents, defaults to DEFAULT_ELEMENT_LOCAL_NAME. Ensure that this 55 is set to a valid string in derived classes rather the None base class 56 setting 57 @type elementLocalName: NoneType/basestring 46 58 @param namespacePrefix: the prefix for the given namespace 59 @type namespacePrefix: basestring 47 60 ''' 48 61 if elementLocalName is None: … … 55 68 @property 56 69 def qname(self): 57 "Qualified Name for this type" 70 """Qualified Name for this type 71 @return: qualified name 72 @rtype: ndg.saml.common.xml.QName 73 """ 58 74 return self.__qname 59 75 60 76 @classmethod 61 77 def fromXML(cls, xmlObject): 62 '''Parse from an XML representation into a SAML object 63 @type: XML class e.g. ElementTree or 4Suite XML 64 @param: XML representation of SAML Object 78 '''Parse from an XML representation into a SAML object. Abstract method 79 - derived types should implement 80 81 @type xmlObject: XML class e.g. ElementTree or 4Suite XML type 82 @param xmlObject: XML representation of SAML Object 65 83 @rtype: saml.saml2.common.SAMLObject derived type 66 84 @return: SAML object … … 70 88 @classmethod 71 89 def toXML(cls, samlObject): 72 '''Convert the input SAML object into an XML representation 73 @type: saml.saml2.common.SAMLObject derived type 74 @param: SAML object 90 '''Convert the input SAML object into an XML representation. Abstract 91 method - derived types should implement 92 @type samlObject: saml.saml2.common.SAMLObject derived type 93 @param samlObject: SAML object 75 94 @rtype: XML class e.g. ElementTree or 4Suite XML 76 95 @return: XML representation of SAML Object … … 79 98 80 99 def __getstate__(self): 81 '''Enable pickling''' 100 '''Enable pickling 101 102 @return: object's attribute dictionary 103 @rtype: dict 104 ''' 82 105 _dict = {} 83 106 for attrName in SAMLObject.__slots__: … … 95 118 96 119 def __setstate__(self, attrDict): 97 '''Enable pickling''' 120 '''Enable pickling 121 122 @param attrDict: object's attribute dictionary 123 @type attrDict: dict 124 ''' 98 125 for attrName, val in attrDict.items(): 99 126 setattr(self, attrName, val) … … 101 128 102 129 class SAMLVersion(object): 103 """Version helper class""" 130 """Version helper class 131 132 @cvar VERSION_10: SAML Version 1.0 identifier 133 @type VERSION_10: tuple 134 @cvar VERSION_11: SAML Version 1.1 identifier 135 @type VERSION_11: tuple 136 @cvar VERSION_20: SAML Version 2.0 identifier 137 @type VERSION_20: tuple 138 @cvar KNOWN_VERSIONS: list of known SAML version identifiers 139 @type KNOWN_VERSIONS: tuple 140 @ivar __version: SAML version for the given class instance 141 @type __version: tuple 142 """ 104 143 105 144 VERSION_10 = (1, 0) … … 111 150 112 151 def __init__(self, version): 152 """Instantiate from a given input version 153 @param version: SAML version to set 154 @type version: basestring or tuple or list 155 @raise TypeError: unexpected type for version input 156 """ 113 157 if isinstance(version, basestring): 114 158 self.__version = SAMLVersion.valueOf(version) … … 120 164 121 165 def __getstate__(self): 122 '''Enable pickling''' 166 '''Enable pickling 167 168 @return: object's attribute dictionary 169 @rtype: dict 170 ''' 123 171 _dict = {} 124 172 for attrName in SAMLVersion.__slots__: … … 133 181 134 182 def __setstate__(self, attrDict): 135 '''Enable pickling''' 183 '''Enable pickling 184 185 @param attrDict: object's attribute dictionary 186 @type attrDict: dict 187 ''' 136 188 for attrName, val in attrDict.items(): 137 189 setattr(self, attrName, val) 138 190 139 191 def __str__(self): 192 """ 193 @return: string representation of SAML version 194 @rtype: string 195 """ 140 196 return ".".join([str(i) for i in self.__version]) 141 197 142 198 def __eq__(self, version): 143 """Test for equality against an input version string, tuple or list""" 199 """Test for equality against an input version string, tuple or list 200 201 @param version: SAML version to test 202 @type version: SAMLVersion, basestring, tuple or list 203 @raise TypeError: unexpected type for version input 204 """ 144 205 if isinstance(version, SAMLVersion): 145 206 return str(self) == str(version) … … 155 216 156 217 def __ne__(self, version): 218 """Test True for this instance version not equal to input version 219 220 @param version: SAML version to test 221 @type version: SAMLVersion, basestring, tuple or list 222 @raise TypeError: unexpected type for version input 223 """ 157 224 return not self.__eq__(version) 158 225 159 226 def __gt__(self, version): 227 """Test True for this instance version greater than input version 228 229 @param version: SAML version to test 230 @type version: SAMLVersion, basestring, tuple or list 231 @raise TypeError: unexpected type for version input 232 """ 160 233 if isinstance(version, basestring): 161 234 return self.__version > SAMLVersion.valueOf(version) … … 167 240 168 241 def __lt__(self, version): 242 """Test True for this instance version less than input version 243 244 @param version: SAML version to test 245 @type version: SAMLVersion, basestring, tuple or list 246 @raise TypeError: unexpected type for version input 247 """ 169 248 if isinstance(version, basestring): 170 249 return self.__version < SAMLVersion.valueOf(version) … … 176 255 177 256 def __ge__(self, version): 257 """Test True for this instance version greater or equal to the input 258 version 259 260 @param version: SAML version to test 261 @type version: SAMLVersion, basestring, tuple or list 262 @raise TypeError: unexpected type for version input 263 """ 178 264 if isinstance(version, basestring): 179 265 return self.__version >= SAMLVersion.valueOf(version) … … 185 271 186 272 def __le__(self, version): 273 """Test True for this instance version less than or equal to input 274 version 275 276 @param version: SAML version to test 277 @type version: SAMLVersion, basestring, tuple or list 278 @raise TypeError: unexpected type for version input 279 """ 187 280 if isinstance(version, basestring): 188 281 return self.__version <= SAMLVersion.valueOf(version) … … 196 289 def valueOf(version): 197 290 """Parse input string into version tuple 198 @type version: version291 @type version: basestring 199 292 @param version: SAML version 200 293 @rtype: tuple -
TI12-security/trunk/ndg_saml/ndg/saml/common/xml.py
r6609 r6900 26 26 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 27 27 __contact__ = "Philip.Kershaw@stfc.ac.uk" 28 __license__ = " BSD - see LICENSE file in top-level directory"28 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 29 29 __contact__ = "Philip.Kershaw@stfc.ac.uk" 30 30 __revision__ = "$Id: $" -
TI12-security/trunk/ndg_saml/ndg/saml/saml2/__init__.py
r6069 r6900 26 26 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 27 27 __contact__ = "Philip.Kershaw@stfc.ac.uk" 28 __license__ = " BSD - see LICENSE file in top-level directory"28 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 29 29 __contact__ = "Philip.Kershaw@stfc.ac.uk" 30 __revision__ = "$Id :$"30 __revision__ = "$Id$" -
TI12-security/trunk/ndg_saml/ndg/saml/saml2/core.py
r6786 r6900 26 26 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 27 27 __contact__ = "Philip.Kershaw@stfc.ac.uk" 28 __license__ = " BSD - see LICENSE file in top-level directory"28 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 29 29 __contact__ = "Philip.Kershaw@stfc.ac.uk" 30 __revision__ = "$Id :$"30 __revision__ = "$Id$" 31 31 from datetime import datetime 32 32 from urlparse import urlsplit, urlunsplit -
TI12-security/trunk/ndg_saml/ndg/saml/test/__init__.py
r6069 r6900 3 3 4 4 NERC DataGrid Project 5 6 This implementation is adapted from the Java OpenSAML implementation. The 7 copyright and licence information are included here: 8 9 Copyright [2005] [University Corporation for Advanced Internet Development, Inc.] 10 11 Licensed under the Apache License, Version 2.0 (the "License"); 12 you may not use this file except in compliance with the License. 13 You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 5 22 """ 6 23 __author__ = "P J Kershaw" 7 24 __date__ = "25/07/08" 8 25 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 9 __license__ = " BSD - see LICENSE file in top-level directory"26 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 10 27 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 __revision__ = '$Id :$'28 __revision__ = '$Id$' -
TI12-security/trunk/ndg_saml/ndg/saml/test/test_saml.py
r6609 r6900 2 2 3 3 NERC DataGrid Project 4 5 This implementation is adapted from the Java OpenSAML implementation. The 6 copyright and licence information are included here: 7 8 Copyright [2005] [University Corporation for Advanced Internet Development, Inc.] 9 10 Licensed under the Apache License, Version 2.0 (the "License"); 11 you may not use this file except in compliance with the License. 12 You may obtain a copy of the License at 13 14 http://www.apache.org/licenses/LICENSE-2.0 15 16 Unless required by applicable law or agreed to in writing, software 17 distributed under the License is distributed on an "AS IS" BASIS, 18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 See the License for the specific language governing permissions and 20 limitations under the License. 4 21 """ 5 22 __author__ = "P J Kershaw" 6 23 __date__ = "21/07/09" 7 24 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 8 __license__ = " BSD - see LICENSE file in top-level directory"25 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 9 26 __contact__ = "Philip.Kershaw@stfc.ac.uk" 10 __revision__ = '$Id :$'27 __revision__ = '$Id$' 11 28 import logging 12 29 logging.basicConfig(level=logging.DEBUG) -
TI12-security/trunk/ndg_saml/ndg/saml/utils.py
r5601 r6900 2 2 3 3 NERC DataGrid Project 4 5 This implementation is adapted from the Java OpenSAML implementation. The 6 copyright and licence information are included here: 7 8 Copyright [2005] [University Corporation for Advanced Internet Development, Inc.] 9 10 Licensed under the Apache License, Version 2.0 (the "License"); 11 you may not use this file except in compliance with the License. 12 You may obtain a copy of the License at 13 14 http://www.apache.org/licenses/LICENSE-2.0 15 16 Unless required by applicable law or agreed to in writing, software 17 distributed under the License is distributed on an "AS IS" BASIS, 18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 See the License for the specific language governing permissions and 20 limitations under the License. 4 21 """ 5 22 __author__ = "P J Kershaw" 6 23 __date__ = "10/08/09" 7 24 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 8 __license__ = " BSD - see LICENSE file in top-level directory"25 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 9 26 __contact__ = "Philip.Kershaw@stfc.ac.uk" 10 __revision__ = '$Id :$'27 __revision__ = '$Id$' 11 28 try: 12 29 from datetime import strptime -
TI12-security/trunk/ndg_saml/ndg/saml/xml/__init__.py
r6069 r6900 24 24 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 25 25 __contact__ = "Philip.Kershaw@stfc.ac.uk" 26 __license__ = " BSD - see LICENSE file in top-level directory"26 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 27 27 __contact__ = "Philip.Kershaw@stfc.ac.uk" 28 __revision__ = "$Id :$"28 __revision__ = "$Id$" 29 29 import logging 30 30 log = logging.getLogger(__name__) 31 31 32 32 33 class XMLConstants(object): 33 34 '''XML related constants.''' -
TI12-security/trunk/ndg_saml/ndg/saml/xml/etree.py
r6786 r6900 25 25 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 26 26 __contact__ = "Philip.Kershaw@stfc.ac.uk" 27 __license__ = " BSD - see LICENSE file in top-level directory"27 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 28 28 __contact__ = "Philip.Kershaw@stfc.ac.uk" 29 __revision__ = "$Id :$"29 __revision__ = "$Id$" 30 30 import logging 31 31 log = logging.getLogger(__name__) -
TI12-security/trunk/ndg_saml/setup.py
r6606 r6900 1 1 #!/usr/bin/env python 2 """SAML Package2 """SAML 2.0 Package 3 3 4 4 NERC DataGrid Project 5 6 This implementation is adapted from the Java OpenSAML implementation. The 7 copyright and licence information are included here: 8 9 Copyright [2005] [University Corporation for Advanced Internet Development, Inc.] 10 11 Licensed under the Apache License, Version 2.0 (the "License"); 12 you may not use this file except in compliance with the License. 13 You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 5 22 """ 6 23 __author__ = "P J Kershaw" 7 24 __date__ = "10/08/09" 8 25 __copyright__ = "(C) 2009 Science and Technology Facilities Council" 9 __license__ = " BSD - see LICENSE file in top-level directory"26 __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 10 27 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 28 __revision__ = '$Id:$' … … 18 35 19 36 _longDescription = """\ 20 SAML 2.0 implementation for use with the NERC DataGrid Attribute and21 Authorisation Query interfaces. The implementation is based on the Java22 OpenSAML libraries. An implementation is provided using ElementTree although it 23 is also possible to add plugins forother Python XML parsers.37 SAML 2.0 implementation for use with the NERC DataGrid / Earth System Grid 38 Project Attribute and Authorisation Query interfaces. The implementation is 39 based on the Java OpenSAML libraries. An implementation is provided with 40 ElementTree but it can easily be extended to use other Python XML parsers. 24 41 25 42 It is not a complete implementation of SAML 2.0. Only those components required … … 30 47 setup( 31 48 name = 'ndg_security_saml', 32 version = '0. 3',49 version = '0.4', 33 50 description = ('SAML 2.0 implementation for the NERC DataGrid ' 34 51 'based on the Java OpenSAML library'), 35 long_description = (),52 long_description = _longDescription, 36 53 author = 'Philip Kershaw', 37 54 author_email = 'Philip.Kershaw@stfc.ac.uk', … … 39 56 maintainer_email = 'Philip.Kershaw@stfc.ac.uk', 40 57 url = 'http://proj.badc.rl.ac.uk/ndg/wiki/Security', 41 license = ' BSD - See LICENCE file for details',58 license = 'http://www.apache.org/licenses/LICENSE-2.0', 42 59 packages = find_packages(), 43 60 namespace_packages = [], 44 61 include_package_data = True, 62 classifiers = [ 63 'Development Status :: Development Status :: 4 - Beta', 64 'Environment :: Console', 65 'Environment :: Web Environment', 66 'Intended Audience :: Developers', 67 'Intended Audience :: System Administrators', 68 'Intended Audience :: Science/Research', 69 'License :: OSI Approved :: OSI Approved :: Apache Software License', 70 'Natural Language :: English', 71 'Operating System :: Microsoft :: Windows', 72 'Operating System :: POSIX :: Linux', 73 'Programming Language :: Python', 74 'Topic :: Security', 75 'Topic :: Internet', 76 'Topic :: Scientific/Engineering', 77 'Topic :: System :: Distributed Computing', 78 'Topic :: System :: Systems Administration :: Authentication/Directory', 79 'Topic :: Software Development :: Libraries :: Python Modules' 80 ], 45 81 zip_safe = False 46 82 )
Note: See TracChangeset
for help on using the changeset viewer.