|
3 | 3 | #
|
4 | 4 | # Generated Mon May 2 14:23:33 2011 by parse_xsd.py version 0.4.
|
5 | 5 | #
|
| 6 | +# A summary of available specifications can be found at: |
| 7 | +# https://wiki.oasis-open.org/security/FrontPage |
| 8 | +# |
| 9 | +# saml core specifications to be found at: |
| 10 | +# if any question arise please query the following pdf. |
| 11 | +# http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf |
| 12 | +# The specification was later updated with errata, and the new version is here: |
| 13 | +# https://www.oasis-open.org/committees/download.php/56776/sstc-saml-core-errata-2.0-wd-07.pdf |
| 14 | +# |
| 15 | + |
| 16 | + |
6 | 17 | import base64
|
7 | 18 |
|
8 | 19 | from saml2.validate import valid_ipv4, MustValueError
|
|
17 | 28 | from saml2 import xmldsig as ds
|
18 | 29 | from saml2 import xmlenc as xenc
|
19 | 30 |
|
| 31 | +# authentication information fields |
20 | 32 | NAMESPACE = 'urn:oasis:names:tc:SAML:2.0:assertion'
|
21 | 33 |
|
22 |
| -XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance' |
| 34 | +# xmlschema definition |
| 35 | +XSD = "xs" |
| 36 | +# xmlschema templates and extensions |
23 | 37 | XS_NAMESPACE = 'http://www.w3.org/2001/XMLSchema'
|
24 |
| - |
| 38 | +# xmlschema-instance, which contains several builtin attributes |
| 39 | +XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance' |
| 40 | +# xml soap namespace |
| 41 | +NS_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/" |
| 42 | +# type definitions for xmlschemas |
25 | 43 | XSI_TYPE = '{%s}type' % XSI_NAMESPACE
|
| 44 | +# nil type definition for xmlschemas |
26 | 45 | XSI_NIL = '{%s}nil' % XSI_NAMESPACE
|
27 | 46 |
|
| 47 | +# idp and sp communicate usually about a subject(NameID) |
| 48 | +# the format determines the category the subject is in |
| 49 | + |
| 50 | +# custom subject |
28 | 51 | NAMEID_FORMAT_UNSPECIFIED = (
|
29 | 52 | "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified")
|
| 53 | +# subject as email address |
30 | 54 | NAMEID_FORMAT_EMAILADDRESS = (
|
31 | 55 | "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress")
|
| 56 | +# subject as x509 key |
32 | 57 | NAMEID_FORMAT_X509SUBJECTNAME = (
|
33 | 58 | "urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName")
|
| 59 | +# subject as windows domain name |
34 | 60 | NAMEID_FORMAT_WINDOWSDOMAINQUALIFIEDNAME = (
|
35 | 61 | "urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName")
|
| 62 | +# subject from a kerberos instance |
36 | 63 | NAMEID_FORMAT_KERBEROS = (
|
37 | 64 | "urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos")
|
| 65 | +# subject as name |
38 | 66 | NAMEID_FORMAT_ENTITY = (
|
39 | 67 | "urn:oasis:names:tc:SAML:2.0:nameid-format:entity")
|
| 68 | +# linked subject |
40 | 69 | NAMEID_FORMAT_PERSISTENT = (
|
41 | 70 | "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent")
|
| 71 | +# annonymous subject |
42 | 72 | NAMEID_FORMAT_TRANSIENT = (
|
43 | 73 | "urn:oasis:names:tc:SAML:2.0:nameid-format:transient")
|
| 74 | +# subject avaiable in encrypted format |
44 | 75 | NAMEID_FORMAT_ENCRYPTED = (
|
45 | 76 | "urn:oasis:names:tc:SAML:2.0:nameid-format:encrypted")
|
| 77 | +# dicc for avaiable formats |
46 | 78 | NAMEID_FORMATS_SAML2 = (
|
47 | 79 | ('NAMEID_FORMAT_EMAILADDRESS', NAMEID_FORMAT_EMAILADDRESS),
|
48 | 80 | ('NAMEID_FORMAT_ENCRYPTED', NAMEID_FORMAT_ENCRYPTED),
|
|
51 | 83 | ('NAMEID_FORMAT_TRANSIENT', NAMEID_FORMAT_TRANSIENT),
|
52 | 84 | ('NAMEID_FORMAT_UNSPECIFIED', NAMEID_FORMAT_UNSPECIFIED),
|
53 | 85 | )
|
| 86 | + |
| 87 | +# a profile outlines a set of rules describing how to embed SAML assertions. |
| 88 | +# https://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf |
| 89 | +# The specification was later updated with errata, and the new version is here: |
| 90 | +# https://www.oasis-open.org/committees/download.php/56782/sstc-saml-profiles-errata-2.0-wd-07.pdf |
| 91 | + |
| 92 | +# XML based values for SAML attributes |
54 | 93 | PROFILE_ATTRIBUTE_BASIC = (
|
55 | 94 | "urn:oasis:names:tc:SAML:2.0:profiles:attribute:basic")
|
56 | 95 |
|
| 96 | +# an AuthnRequest is made to initiate authentication |
| 97 | +# authenticate the request with login credentials |
57 | 98 | AUTHN_PASSWORD = "urn:oasis:names:tc:SAML:2.0:ac:classes:Password"
|
| 99 | +# authenticate the request with login credentials, over tls/https |
58 | 100 | AUTHN_PASSWORD_PROTECTED = \
|
59 | 101 | "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
|
60 | 102 |
|
| 103 | +# attribute statements is key:value metadata shared with your app |
| 104 | + |
| 105 | +# custom format |
61 | 106 | NAME_FORMAT_UNSPECIFIED = (
|
62 | 107 | "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified")
|
| 108 | +# uri format |
63 | 109 | NAME_FORMAT_URI = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
|
| 110 | +# XML-based format |
64 | 111 | NAME_FORMAT_BASIC = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
| 112 | +# dicc for avaiable formats |
65 | 113 | NAME_FORMATS_SAML2 = (
|
66 | 114 | ('NAME_FORMAT_BASIC', NAME_FORMAT_BASIC),
|
67 | 115 | ('NAME_FORMAT_URI', NAME_FORMAT_URI),
|
68 | 116 | ('NAME_FORMAT_UNSPECIFIED', NAME_FORMAT_UNSPECIFIED),
|
69 | 117 | )
|
| 118 | + |
| 119 | +# the SAML authority's decision can be predetermined by arbitrary context |
| 120 | + |
| 121 | +# the specified action is permitted |
70 | 122 | DECISION_TYPE_PERMIT = "Permit"
|
| 123 | +# the specified action is denied |
71 | 124 | DECISION_TYPE_DENY = "Deny"
|
| 125 | +# the SAML authority cannot determine if the action is permitted or denied |
72 | 126 | DECISION_TYPE_INDETERMINATE = "Indeterminate"
|
73 | 127 |
|
| 128 | + |
| 129 | +# consent attributes determine wether consent has been given and under |
| 130 | +# what conditions |
| 131 | + |
| 132 | +# no claim to consent is made |
74 | 133 | CONSENT_UNSPECIFIED = "urn:oasis:names:tc:SAML:2.0:consent:unspecified"
|
| 134 | +# consent has been obtained |
75 | 135 | CONSENT_OBTAINED = "urn:oasis:names:tc:SAML:2.0:consent:obtained"
|
| 136 | +# consent has been obtained before the message has been initiated |
76 | 137 | CONSENT_PRIOR = "urn:oasis:names:tc:SAML:2.0:consent:prior"
|
| 138 | +# consent has been obtained implicitly |
77 | 139 | CONSENT_IMPLICIT = "urn:oasis:names:tc:SAML:2.0:consent:current-implicit"
|
| 140 | +# consent has been obtained explicitly |
78 | 141 | CONSENT_EXPLICIT = "urn:oasis:names:tc:SAML:2.0:consent:current-explicit"
|
| 142 | +# no consent has been obtained |
79 | 143 | CONSENT_UNAVAILABLE = "urn:oasis:names:tc:SAML:2.0:consent:unavailable"
|
| 144 | +# no consent is needed. |
80 | 145 | CONSENT_INAPPLICABLE = "urn:oasis:names:tc:SAML:2.0:consent:inapplicable"
|
81 | 146 |
|
| 147 | + |
| 148 | +# Subject confirmation methods(scm), can be issued, besides the subject itself |
| 149 | +# by third parties. |
| 150 | +# http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0.pdf |
| 151 | + |
| 152 | +# the 3rd party is identified on behalf of the subject given private/public key |
82 | 153 | SCM_HOLDER_OF_KEY = "urn:oasis:names:tc:SAML:2.0:cm:holder-of-key"
|
| 154 | +# the 3rd party is identified by subject confirmation and must include a security header |
| 155 | +# signing its content. |
83 | 156 | SCM_SENDER_VOUCHES = "urn:oasis:names:tc:SAML:2.0:cm:sender-vouches"
|
| 157 | +# a bearer token is issued instead. |
84 | 158 | SCM_BEARER = "urn:oasis:names:tc:SAML:2.0:cm:bearer"
|
85 | 159 |
|
86 |
| -XSD = "xs" |
87 |
| -NS_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/" |
88 |
| - |
89 | 160 |
|
90 | 161 | class AttributeValueBase(SamlBase):
|
91 | 162 | def __init__(self,
|
|
0 commit comments