Skip to content

Commit 495d5f6

Browse files
author
Hans Hörberg
committed
Merge remote-tracking branch 'upstream/master'
2 parents 2e1bbc8 + 58181bd commit 495d5f6

24 files changed

+623
-307
lines changed

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
# built documents.
4646
#
4747
# The short X.Y version.
48-
version = '0.4'
48+
version = '1.2'
4949
# The full version, including alpha/beta/rc tags.
50-
release = '0.4.2'
50+
release = '1.2.0beta'
5151

5252
# The language for content autogenerated by Sphinx. Refer to documentation
5353
# for a list of supported languages.

doc/install.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Install PySAML2
1010
---------------
1111

1212
For all this to work you need to have Python installed.
13-
The development has been done using 2.6.
14-
There is no 3.X version yet.
13+
The development has been done using 2.7.
14+
There is now a 3.X version.
1515

1616
Prerequisites
1717
^^^^^^^^^^^^^
@@ -21,19 +21,17 @@ if it's recent enough, or if the Python is too old you have to install it,
2121
for instance by getting it from the Python Package Instance by using
2222
easy_install.
2323

24-
You also need xmlsec which you can download from http://www.aleksey.com/xmlsec/
24+
You also need xmlsec1 which you can download from http://www.aleksey.com/xmlsec/
2525

26-
If you're on OS X you can get xmlsec installed from MacPorts or Fink.
26+
If you're on OS X you can get xmlsec1 installed from MacPorts or Fink.
2727

2828
Depending on how you are going to use PySAML2 you might also need
2929

3030
* Mako
3131
* pyASN1
32-
* repoze.who (make sure you get 1.0.16 and not 2.0)
33-
* decorator
32+
* repoze.who
3433
* python-memcache
3534
* memcached
36-
* M2Crypto
3735

3836
Quick build instructions
3937
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -44,6 +42,10 @@ Once you have installed all the necessary prerequisites a simple::
4442

4543
will install the basic code.
4644

45+
Note for rhel/centos 6: cffi depends on libffi-devel, and cryptography on openssl-devel to compile
46+
So you might want first to do:
47+
yum install libffi-devel openssl-devel
48+
4749
After this you ought to be able to run the tests without an hitch.
4850
The tests are based on the pypy test environment, so::
4951

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def run_tests(self):
4545
'repoze.who',
4646
'pycrypto', # 'Crypto'
4747
'pytz',
48-
'pyOpenSSL'
48+
'pyOpenSSL',
49+
'python-dateutil'
4950
]
5051

5152
tests_require = [

src/saml2/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,12 @@ class SamlBase(ExtensionContainer):
444444
c_children = {}
445445
c_attributes = {}
446446
c_attribute_type = {}
447-
#c_attribute_use = {}
448-
#c_attribute_required = {}
449447
c_child_order = []
450448
c_cardinality = {}
451449
c_any = None
452450
c_any_attribute = None
453451
c_value_type = None
452+
c_ns_prefix = None
454453

455454
def _get_all_c_children_with_order(self):
456455
if len(self.c_child_order) > 0:
@@ -549,6 +548,9 @@ def to_string(self, nspair=None):
549548
constructing the text representation.
550549
:return: String representation of the object
551550
"""
551+
if not nspair and self.c_ns_prefix:
552+
nspair = self.c_ns_prefix
553+
552554
if nspair:
553555
for prefix, uri in nspair.items():
554556
try:

src/saml2/attributemaps/saml_uri.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
UCL_DIR_PILOT = 'urn:oid:0.9.2342.19200300.100.1.'
88
PKCS_9 = "urn:oid:1.2.840.113549.1.9.1."
99
UMICH = "urn:oid:1.3.6.1.4.1.250.1.57."
10-
SCHAC = "urn:oid:1.3.6.1.4.1.25178.2."
10+
SCHAC = "urn:oid:1.3.6.1.4.1.25178.1.2."
1111

1212
#urn:oid:1.3.6.1.4.1.1466.115.121.1.26
1313

src/saml2/client.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,6 @@ def handle_logout_response(self, response):
254254
status["reason"], status["not_on_or_after"],
255255
status["sign"])
256256

257-
# ========================================================================
258-
# MUST use SOAP for
259-
# AssertionIDRequest, SubjectQuery, AuthnQuery, AttributeQuery or
260-
# AuthzDecisionQuery
261-
# ========================================================================
262-
263257
def _use_soap(self, destination, query_type, **kwargs):
264258
_create_func = getattr(self, "create_%s" % query_type)
265259
_response_func = getattr(self, "parse_%s_response" % query_type)
@@ -432,13 +426,14 @@ def handle_logout_request(self, request, name_id, binding, sign=False,
432426
:param sign: Whether the response will be signed or not
433427
:return: Keyword arguments which can be used to send the response
434428
what's returned follow different patterns for different bindings.
435-
If the binding is BINDIND_SOAP, what is returned looks like this:
436-
{
437-
"data": <the SOAP enveloped response>
438-
"url": "",
439-
'headers': [('content-type', 'application/soap+xml')]
440-
'method': "POST
441-
}
429+
If the binding is BINDIND_SOAP, what is returned looks like this::
430+
431+
{
432+
"data": <the SOAP enveloped response>
433+
"url": "",
434+
'headers': [('content-type', 'application/soap+xml')]
435+
'method': "POST
436+
}
442437
"""
443438
logger.info("logout request: %s" % request)
444439

src/saml2/config.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
"verify_encrypt_cert",
7171
"tmp_cert_file",
7272
"tmp_key_file",
73-
"validate_certificate"
73+
"validate_certificate",
74+
"extensions"
7475
]
7576

7677
SP_ARGS = [
@@ -219,6 +220,7 @@ def __init__(self, homedir="."):
219220
self.tmp_cert_file = None
220221
self.tmp_key_file = None
221222
self.validate_certificate = None
223+
self.extensions = {}
222224

223225
def setattr(self, context, attr, val):
224226
if context == "":
@@ -337,6 +339,9 @@ def load(self, cnf, metadata_construction=False):
337339
except KeyError:
338340
pass
339341

342+
if "extensions" in cnf:
343+
self.do_extensions(cnf["extensions"])
344+
340345
self.load_complex(cnf, metadata_construction=metadata_construction)
341346
self.context = self.def_context
342347

@@ -480,6 +485,11 @@ def endpoint2service(self, endpoint, context=None):
480485

481486
return None, None
482487

488+
def do_extensions(self, extensions):
489+
for key, val in extensions.items():
490+
self.extensions[key] = val
491+
492+
483493
class SPConfig(Config):
484494
def_context = "sp"
485495

src/saml2/entity_category/incommon.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
__author__ = 'rolandh'
22

3-
INC = "http://id.incommon.org/category/research-and-scholarship"
3+
RESEARCH_AND_SCHOLARSHIP = "http://id.incommon.org/category/research-and-scholarship"
44

55
RELEASE = {
66
"": ["eduPersonTargetedID"],
7-
INC: ["eduPersonPrincipalName", "eduPersonScopedAffiliation", "mail",
8-
"givenName", "sn", "displayName"]
7+
RESEARCH_AND_SCHOLARSHIP: ["eduPersonPrincipalName",
8+
"eduPersonScopedAffiliation", "mail",
9+
"givenName", "sn", "displayName"]
910
}
1011

src/saml2/entity_category/refeds.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
__author__ = 'rolandh'
2+
3+
RESEARCH_AND_SCHOLARSHIP = "http://refeds.org/category/research-and-scholarship"
4+
5+
RELEASE = {
6+
"": ["eduPersonTargetedID"],
7+
RESEARCH_AND_SCHOLARSHIP: ["eduPersonPrincipalName",
8+
"eduPersonScopedAffiliation", "mail",
9+
"givenName", "sn", "displayName"]
10+
}
11+

src/saml2/entity_category/swamid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
NAME = ["givenName", "displayName", "sn"]
5-
STATIC_ORG_INFO = ["c", "o", "co"]
5+
STATIC_ORG_INFO = ["c", "o", "co", "norEduOrgAcronym", "schacHomeOrganization"]
66
OTHER = ["eduPersonPrincipalName", "eduPersonScopedAffiliation", "mail"]
77

88
# These give you access to information

0 commit comments

Comments
 (0)