Skip to content

Commit fb5d189

Browse files
authored
Merge pull request #8 from IdentityPython/master
pysaml2 updates
2 parents 1bc8a00 + 79f5fad commit fb5d189

File tree

11 files changed

+25
-23
lines changed

11 files changed

+25
-23
lines changed

docs/install.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ You also need xmlsec1 which you can download from http://www.aleksey.com/xmlsec/
2525

2626
If you're on macOS, you can get xmlsec1 installed from MacPorts or Fink.
2727

28+
If you're on rhel/centos 7 you will need to install xmlsec1 and xmlsec1-openssl::
29+
30+
yum install xmlsec1 xmlsec1-openssl
31+
2832
Depending on how you are going to use PySAML2 you might also need
2933

3034
* Mako

src/saml2/httpbase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def set_cookie(self, kaka, request):
196196
std_attr["domain"] = _domain
197197
std_attr["domain_specified"] = True
198198

199-
if morsel["max-age"] is 0:
199+
if morsel["max-age"] == 0:
200200
try:
201201
self.cookiejar.clear(domain=std_attr["domain"],
202202
path=std_attr["path"],

src/saml2/response.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,8 @@ def for_me(conditions, myself):
212212
if audience.text.strip() == myself:
213213
return True
214214
else:
215-
# print("Not for me: %s != %s" % (audience.text.strip(),
216-
# myself))
217-
pass
218-
215+
logger.debug("AudienceRestriction - One condition not satisfied: %s != %s" % (audience.text.strip(), myself))
216+
logger.debug("AudienceRestrictions not satisfied!")
219217
return False
220218

221219

@@ -613,7 +611,7 @@ def condition_ok(self, lax=False):
613611

614612
if not for_me(conditions, self.entity_id):
615613
if not lax:
616-
raise Exception("Not for me!!!")
614+
raise Exception("AudienceRestrictions conditions not satisfied! (Local entity_id=%s)" % self.entity_id)
617615

618616
if conditions.condition: # extra conditions
619617
for cond in conditions.condition:

src/saml2/s2repoze/plugins/sp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def make_plugin(
670670
discovery="",
671671
idp_query_param="",
672672
):
673-
if saml_conf is "":
673+
if saml_conf == "":
674674
raise ValueError("must include saml_conf in configuration")
675675

676676
if remember_name is None:

src/saml2/saml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def _wrong_type_value(xsd, value):
256256

257257
xsd_ns, xsd_type = (
258258
['', type(None)] if xsd_string is None
259-
else ['', ''] if xsd_string is ''
259+
else ['', ''] if xsd_string == ''
260260
else [
261261
XSD if xsd_string in xsd_types_props else '',
262262
xsd_string

src/saml2/sigver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def extract_rsa_key_from_x509_cert(pem):
450450

451451

452452
def pem_format(key):
453-
return '\n'.join([
453+
return os.linesep.join([
454454
'-----BEGIN CERTIFICATE-----',
455455
key,
456456
'-----END CERTIFICATE-----'

src/saml2/soap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def parse_soap_enveloped_saml_thingy(text, expected_tags):
159159

160160
import re
161161

162-
NS_AND_TAG = re.compile("\{([^}]+)\}(.*)")
162+
NS_AND_TAG = re.compile(r"\{([^}]+)\}(.*)")
163163

164164

165165
def instanciate_class(item, modules):

src/saml2/time_util.py

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

1919
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
2020
TIME_FORMAT_WITH_FRAGMENT = re.compile(
21-
"^(\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2})(\.\d*)?Z?$")
21+
r"^(\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2})(\.\d*)?Z?$")
2222

2323
# ---------------------------------------------------------------------------
2424
# I'm sure this is implemented somewhere else can't find it now though, so I

src/saml2/validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ToEarly(Exception):
4141
# --------------------- validators -------------------------------------
4242
#
4343

44-
NCNAME = re.compile("(?P<NCName>[a-zA-Z_](\w|[_.-])*)")
44+
NCNAME = re.compile(r"(?P<NCName>[a-zA-Z_](\w|[_.-])*)")
4545

4646

4747
def valid_ncname(name):
@@ -436,7 +436,7 @@ def valid_instance(instance):
436436

437437
def valid_domain_name(dns_name):
438438
m = re.match(
439-
"^[a-z0-9]+([-.]{ 1 }[a-z0-9]+).[a-z]{2,5}(:[0-9]{1,5})?(\/.)?$",
439+
r"^[a-z0-9]+([-.]{ 1 }[a-z0-9]+).[a-z]{2,5}(:[0-9]{1,5})?(\/.)?$",
440440
dns_name, re.I)
441441
if not m:
442442
raise ValueError("Not a proper domain name")

tests/metadata.aaitest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
88
ID="AAITest-20140205105921"
99
Name="urn:mace:switch.ch:aaitest"
10-
validUntil="2020-02-10T09:59:21Z"
10+
validUntil="2999-02-10T09:59:21Z"
1111
xsi:schemaLocation="urn:oasis:names:tc:SAML:2.0:metadata saml-schema-metadata-2.0.xsd urn:mace:shibboleth:metadata:1.0 shibboleth-metadata-1.0.xsd http://www.w3.org/2000/09/xmldsig# xmldsig-core-schema.xsd">
1212
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
1313
<ds:SignedInfo>
@@ -135,9 +135,9 @@
135135
</ds:KeyInfo>
136136
</ds:Signature>
137137
<!--
138-
This metadata file is generated for the AAI Test federation,
138+
This metadata file is generated for the AAI Test federation,
139139
which is for development and testing purposes only!
140-
Use at your own risk. SWITCH won't take responsibility
140+
Use at your own risk. SWITCH won't take responsibility
141141
for the data included in this file.
142142
-->
143143
<Extensions>

0 commit comments

Comments
 (0)