Skip to content

Commit c356e44

Browse files
author
wibed
committed
some documentation for newcomers and returners
1 parent c1fab71 commit c356e44

File tree

2 files changed

+79
-6
lines changed

2 files changed

+79
-6
lines changed

src/saml2/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,18 @@
6060
DECISION_TYPE_INDETERMINATE = "Indeterminate"
6161

6262
VERSION = "2.0"
63-
63+
# http://docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf
64+
# parse a SOAP header, make a SOAP request, and receive a SOAP response
6465
BINDING_SOAP = 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'
66+
# parse a PAOS header, make a PAOS request, and receive a PAOS response
6567
BINDING_PAOS = 'urn:oasis:names:tc:SAML:2.0:bindings:PAOS'
68+
# URI encoded messages
6669
BINDING_HTTP_REDIRECT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
70+
# HTML encoded messages
6771
BINDING_HTTP_POST = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
72+
# sensitive messages are transported over a backchannel
6873
BINDING_HTTP_ARTIFACT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact'
74+
# as uri response encoded message
6975
BINDING_URI = 'urn:oasis:names:tc:SAML:2.0:bindings:URI'
7076

7177

src/saml2/saml.py

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
#
44
# Generated Mon May 2 14:23:33 2011 by parse_xsd.py version 0.4.
55
#
6+
# saml core specifications to be found at:
7+
# if any question arise please query the following pdf.
8+
# http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf
9+
#
10+
11+
612
import base64
713

814
from saml2.validate import valid_ipv4, MustValueError
@@ -17,32 +23,53 @@
1723
from saml2 import xmldsig as ds
1824
from saml2 import xmlenc as xenc
1925

26+
# authentication information fields
2027
NAMESPACE = 'urn:oasis:names:tc:SAML:2.0:assertion'
2128

22-
XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
29+
# xmlschema definition
30+
XSD = "xs"
31+
# xmlschema templates and extensions
2332
XS_NAMESPACE = 'http://www.w3.org/2001/XMLSchema'
24-
33+
# xmlschema-instance, which contains several builtin attributes
34+
XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
35+
# xml soap namespace
36+
NS_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/"
37+
# type definitions for xmlschemas
2538
XSI_TYPE = '{%s}type' % XSI_NAMESPACE
39+
# nil type definition for xmlschemas
2640
XSI_NIL = '{%s}nil' % XSI_NAMESPACE
2741

42+
# idp and sp communicate usually about a subject(NameID)
43+
# the format determines the category the subject is in
44+
45+
# custom subject
2846
NAMEID_FORMAT_UNSPECIFIED = (
2947
"urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified")
48+
# subject as email address
3049
NAMEID_FORMAT_EMAILADDRESS = (
3150
"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress")
51+
# subject as x509 key
3252
NAMEID_FORMAT_X509SUBJECTNAME = (
3353
"urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName")
54+
# subject as windows domain name
3455
NAMEID_FORMAT_WINDOWSDOMAINQUALIFIEDNAME = (
3556
"urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName")
57+
# subject from a kerberos instance
3658
NAMEID_FORMAT_KERBEROS = (
3759
"urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos")
60+
# subject as name
3861
NAMEID_FORMAT_ENTITY = (
3962
"urn:oasis:names:tc:SAML:2.0:nameid-format:entity")
63+
# linked subject
4064
NAMEID_FORMAT_PERSISTENT = (
4165
"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent")
66+
# annonymous subject
4267
NAMEID_FORMAT_TRANSIENT = (
4368
"urn:oasis:names:tc:SAML:2.0:nameid-format:transient")
69+
# subject avaiable in encrypted format
4470
NAMEID_FORMAT_ENCRYPTED = (
4571
"urn:oasis:names:tc:SAML:2.0:nameid-format:encrypted")
72+
# dicc for avaiable formats
4673
NAMEID_FORMATS_SAML2 = (
4774
('NAMEID_FORMAT_EMAILADDRESS', NAMEID_FORMAT_EMAILADDRESS),
4875
('NAMEID_FORMAT_ENCRYPTED', NAMEID_FORMAT_ENCRYPTED),
@@ -51,41 +78,81 @@
5178
('NAMEID_FORMAT_TRANSIENT', NAMEID_FORMAT_TRANSIENT),
5279
('NAMEID_FORMAT_UNSPECIFIED', NAMEID_FORMAT_UNSPECIFIED),
5380
)
81+
82+
# a profile outlines a set of rules describing how to embed SAML assertions.
83+
# https://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf
84+
85+
# XML based values for SAML attributes
5486
PROFILE_ATTRIBUTE_BASIC = (
5587
"urn:oasis:names:tc:SAML:2.0:profiles:attribute:basic")
5688

89+
# an AuthnRequest is made to initiate authentication
90+
# TODO: it is not clear that the request sets the context
91+
# for the AuthnRequest, maybe rename to AUTHN_CONTEXT_PASSWORD
92+
93+
# authenticate the request with login credentials
5794
AUTHN_PASSWORD = "urn:oasis:names:tc:SAML:2.0:ac:classes:Password"
95+
# authenticate the request with login credentials, over tls/https
5896
AUTHN_PASSWORD_PROTECTED = \
5997
"urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
6098

99+
# attribute statements is key:value metadata shared with your app
100+
101+
# custom format
61102
NAME_FORMAT_UNSPECIFIED = (
62103
"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified")
104+
# uri format
63105
NAME_FORMAT_URI = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
106+
# XML-based format
64107
NAME_FORMAT_BASIC = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
108+
# dicc for avaiable formats
65109
NAME_FORMATS_SAML2 = (
66110
('NAME_FORMAT_BASIC', NAME_FORMAT_BASIC),
67111
('NAME_FORMAT_URI', NAME_FORMAT_URI),
68112
('NAME_FORMAT_UNSPECIFIED', NAME_FORMAT_UNSPECIFIED),
69113
)
114+
115+
# the SAML authority's decision can be predetermined by arbitrary context
116+
117+
# the specified action is permitted
70118
DECISION_TYPE_PERMIT = "Permit"
119+
# the specified action is denied
71120
DECISION_TYPE_DENY = "Deny"
121+
# the SAML authority cannot determine if the action is permitted or denied
72122
DECISION_TYPE_INDETERMINATE = "Indeterminate"
73123

124+
125+
# consent attributes determine wether consent has been given and under
126+
# what conditions
127+
128+
# no claim to consent is made
74129
CONSENT_UNSPECIFIED = "urn:oasis:names:tc:SAML:2.0:consent:unspecified"
130+
# consent has been obtained
75131
CONSENT_OBTAINED = "urn:oasis:names:tc:SAML:2.0:consent:obtained"
132+
# consent has been obtained before the message has been initiated
76133
CONSENT_PRIOR = "urn:oasis:names:tc:SAML:2.0:consent:prior"
134+
# consent has been obtained implicitly
77135
CONSENT_IMPLICIT = "urn:oasis:names:tc:SAML:2.0:consent:current-implicit"
136+
# consent has been obtained explicitly
78137
CONSENT_EXPLICIT = "urn:oasis:names:tc:SAML:2.0:consent:current-explicit"
138+
# no consent has been obtained
79139
CONSENT_UNAVAILABLE = "urn:oasis:names:tc:SAML:2.0:consent:unavailable"
140+
# no consent is needed.
80141
CONSENT_INAPPLICABLE = "urn:oasis:names:tc:SAML:2.0:consent:inapplicable"
81142

143+
144+
# Subject confirmation methods(scm), can be issued, besides the subject itself
145+
# by third parties.
146+
# http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0.pdf
147+
148+
# the 3rd party is identified on behalf of the subject given private/public key
82149
SCM_HOLDER_OF_KEY = "urn:oasis:names:tc:SAML:2.0:cm:holder-of-key"
150+
# the 3rd party is identified by subject confirmation and must include a security header
151+
# signing its content.
83152
SCM_SENDER_VOUCHES = "urn:oasis:names:tc:SAML:2.0:cm:sender-vouches"
153+
# a bearer token is issued instead.
84154
SCM_BEARER = "urn:oasis:names:tc:SAML:2.0:cm:bearer"
85155

86-
XSD = "xs"
87-
NS_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/"
88-
89156

90157
class AttributeValueBase(SamlBase):
91158
def __init__(self,

0 commit comments

Comments
 (0)