From 9bb8111c2c9d8bcc73c1f5f0649367f327613ae7 Mon Sep 17 00:00:00 2001 From: Itamar Ostricher Date: Thu, 3 Mar 2016 11:50:24 +0200 Subject: [PATCH 1/2] Update Python packages to more recent versions, including required fix in templates Verified working with Python 2.7.10 --- requirements.txt | 42 ++++++++++++++++++++-------------------- templates/base.html | 3 +-- templates/main_page.html | 2 +- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/requirements.txt b/requirements.txt index 19259f7..78b6483 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,29 +1,29 @@ Flask==0.10.1 -Flask-Bootstrap==3.3.2.1 -Flask-Login==0.2.11 -Jinja2==2.7.3 +Flask-Bootstrap==3.3.5.7 +Flask-Login==0.3.2 +Jinja2==2.8 MarkupSafe==0.23 Paste==2.0.2 -WebOb==1.4.1 -Werkzeug==0.10.4 -argparse==1.3.0 -cffi==0.9.2 -cryptography==0.9 -decorator==3.4.2 -enum34==1.0.4 -gunicorn==19.3.0 -idna==1.1 -ipaddress==1.0.7 +WebOb==1.5.1 +Werkzeug==0.11.4 +argparse==1.4.0 +cffi==1.5.2 +cryptography==1.2.3 +decorator==4.0.9 +enum34==1.1.2 +gunicorn==19.4.5 +idna==2.0 +ipaddress==1.0.16 itsdangerous==0.24 pyOpenSSL==0.15.1 -pyasn1==0.1.7 -pycparser==2.13 +pyasn1==0.1.9 +pycparser==2.14 pycrypto==2.6.1 -pysaml2==2.4.0 -python-dateutil==2.4.2 -pytz==2015.4 +pysaml2==4.0.3 +python-dateutil==2.5.0 +pytz==2015.7 repoze.who==2.2 -requests==2.7.0 -six==1.9.0 +requests==2.9.1 +six==1.10.0 wsgiref==0.1.2 -zope.interface==4.1.2 +zope.interface==4.1.3 diff --git a/templates/base.html b/templates/base.html index 2838343..69fd37c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -16,7 +16,7 @@ {% endblock %} - diff --git a/templates/main_page.html b/templates/main_page.html index 2834f31..1805a06 100644 --- a/templates/main_page.html +++ b/templates/main_page.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% block content %} -{% if current_user.is_authenticated() %} +{% if current_user.is_authenticated %}

Logged in

From 173c2e8ac542e7e3f3c53043f9666b16cd295894 Mon Sep 17 00:00:00 2001 From: Itamar Ostricher Date: Thu, 3 Mar 2016 11:51:51 +0200 Subject: [PATCH 2/2] Use inline PySAML2 metadata instead of local tempfile Verified working with updated Python packages under Python 2.7.10 --- app.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/app.py b/app.py index 9223975..e387667 100644 --- a/app.py +++ b/app.py @@ -89,24 +89,13 @@ def saml_client_for(idp_name=None): _external=True, _scheme='https') - # NOTE: - # Ideally, this should fetch the metadata and pass it to - # PySAML2 via the "inline" metadata type. - # However, this method doesn't seem to work on PySAML2 v2.4.0 - # # SAML metadata changes very rarely. On a production system, # this data should be cached as approprate for your production system. rv = requests.get(metadata_url_for[idp_name]) - import tempfile - tmp = tempfile.NamedTemporaryFile() - f = open(tmp.name, 'w') - f.write(rv.text) - f.close() settings = { 'metadata': { - # 'inline': metadata, - "local": [tmp.name] + 'inline': [rv.text], }, 'service': { 'sp': { @@ -134,7 +123,6 @@ def saml_client_for(idp_name=None): spConfig.load(settings) spConfig.allow_unknown_attributes = True saml_client = Saml2Client(config=spConfig) - tmp.close() return saml_client