Package ndg :: Package saml :: Package xml
[hide private]

Source Code for Package ndg.saml.xml

  1  """Implementation of SAML 2.0 for NDG Security - XML package 
  2   
  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. 
 21  """ 
 22  __author__ = "P J Kershaw" 
 23  __date__ = "23/07/09" 
 24  __copyright__ = "(C) 2009 Science and Technology Facilities Council" 
 25  __contact__ = "Philip.Kershaw@stfc.ac.uk" 
 26  __license__ = "http://www.apache.org/licenses/LICENSE-2.0" 
 27  __contact__ = "Philip.Kershaw@stfc.ac.uk" 
 28  __revision__ = "$Id: __init__.py 7130 2010-06-30 13:33:07Z pjkersha $" 
 29  import logging 
 30  log = logging.getLogger(__name__) 
 31      
 32   
33 -class XMLConstants(object):
34 '''XML related constants. 35 36 @cvar XMLTOOLING_CONFIG_NS: Configuration namespace 37 @type XMLTOOLING_CONFIG_NS: string 38 @cvar XMLTOOLING_CONFIG_PREFIX: Configuration namespace prefix 39 @type XMLTOOLING_CONFIG_PREFIX: string 40 @cvar XMLTOOLING_DEFAULT_OBJECT_PROVIDER: object provider 41 @type XMLTOOLING_DEFAULT_OBJECT_PROVIDER: string 42 @cvar XML_NS: XML core namespace 43 @type XML_NS: string 44 @cvar XML_PREFIX: XML core prefix for xml attributes 45 @type XML_PREFIX: string 46 @cvar XMLNS_NS: XML namespace for xmlns attributes 47 @type XMLNS_NS: string 48 @cvar XMLNS_PREFIX: XML namespace prefix for xmlns attributes 49 @type XMLNS_PREFIX: string 50 @cvar XSD_NS: XML Schema namespace 51 @type XSD_NS: string 52 @cvar XSD_PREFIX: XML Schema QName prefix 53 @type XSD_PREFIX: string 54 @cvar XSI_NS: XML Schema Instance namespace 55 @type XSI_NS: string 56 @cvar XSI_PREFIX: XML Schema Instance QName prefix 57 @type XSI_PREFIX: string 58 @cvar XMLSIG_NS: XML XMLSecSignatureImpl namespace 59 @type XMLSIG_NS: string 60 @cvar XMLSIG_PREFIX: XML XMLSecSignatureImpl QName prefix 61 @type XMLSIG_PREFIX: string 62 @cvar XMLENC_NS: XML Encryption namespace 63 @type XMLENC_NS: string 64 @cvar XMLENC_PREFIX: XML Encryption QName prefix 65 @type XMLENC_PREFIX: string 66 @cvar XMLENC_ENCDATA_LOCAL_NAME: Local name of EncryptedData element 67 @type XMLENC_ENCDATA_LOCAL_NAME: string 68 @cvar XMLENC_ENCKEY_LOCAL_NAME: Local name of EncryptedKey element 69 @type XMLENC_ENCKEY_LOCAL_NAME: string 70 ''' 71 72 # XML Tooling 73 74 # Configuration namespace 75 XMLTOOLING_CONFIG_NS = "http://www.opensaml.org/xmltooling-config" 76 77 # Configuration namespace prefix 78 XMLTOOLING_CONFIG_PREFIX = "xt" 79 80 # Name of the object provider used for objects that don't have a registered 81 # object provider 82 XMLTOOLING_DEFAULT_OBJECT_PROVIDER = "DEFAULT" 83 84 # Core XML 85 86 # XML core namespace 87 XML_NS = "http://www.w3.org/XML/1998/namespace" 88 89 # XML core prefix for xml attributes 90 XML_PREFIX = "xml" 91 92 # XML namespace for xmlns attributes 93 XMLNS_NS = "http://www.w3.org/2000/xmlns/" 94 95 # XML namespace prefix for xmlns attributes 96 XMLNS_PREFIX = "xmlns" 97 98 # XML Schema namespace 99 XSD_NS = "http://www.w3.org/2001/XMLSchema" 100 101 # XML Schema QName prefix 102 XSD_PREFIX = "xs" 103 104 # XML Schema Instance namespace 105 XSI_NS = "http://www.w3.org/2001/XMLSchema-instance" 106 107 # XML Schema Instance QName prefix 108 XSI_PREFIX = "xsi" 109 110 # XML XMLSecSignatureImpl namespace 111 XMLSIG_NS = "http://www.w3.org/2000/09/xmldsig#" 112 113 # XML XMLSecSignatureImpl QName prefix 114 XMLSIG_PREFIX = "ds" 115 116 # XML Encryption namespace 117 XMLENC_NS = "http://www.w3.org/2001/04/xmlenc#" 118 119 # XML Encryption QName prefix 120 XMLENC_PREFIX = "xenc" 121 122 # Local name of EncryptedData element 123 XMLENC_ENCDATA_LOCAL_NAME = "EncryptedData" 124 125 # Local name of EncryptedKey element 126 XMLENC_ENCKEY_LOCAL_NAME = "EncryptedKey"
127 128
129 -class XMLTypeError(Exception):
130 """Generic XML type exception"""
131
132 -class XMLTypeParseError(XMLTypeError):
133 """Parse error for XML type"""
134
135 -class UnknownAttrProfile(XMLTypeError):
136 """Raise from Attribute Value factory if attribute type is not recognised 137 """
138