Merge pull request #2 from itamaro/master

Update Python packages, use inline metadata, Dockerize app
master
Joël Franusic 9 years ago
commit 946110b218

@ -0,0 +1,13 @@
FROM python:2.7
# Install xmlsec1
RUN echo 'deb http://mirror.isoc.org.il/pub/ubuntu/ trusty main universe' >> /etc/apt/sources.list && \
apt-get update && \
apt-get -y --no-install-recommends install xmlsec1
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
CMD python app.py

@ -89,24 +89,13 @@ def saml_client_for(idp_name=None):
_external=True, _external=True,
_scheme='https') _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, # SAML metadata changes very rarely. On a production system,
# this data should be cached as approprate for your production system. # this data should be cached as approprate for your production system.
rv = requests.get(metadata_url_for[idp_name]) 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 = { settings = {
'metadata': { 'metadata': {
# 'inline': metadata, 'inline': [rv.text],
"local": [tmp.name]
}, },
'service': { 'service': {
'sp': { 'sp': {
@ -134,7 +123,6 @@ def saml_client_for(idp_name=None):
spConfig.load(settings) spConfig.load(settings)
spConfig.allow_unknown_attributes = True spConfig.allow_unknown_attributes = True
saml_client = Saml2Client(config=spConfig) saml_client = Saml2Client(config=spConfig)
tmp.close()
return saml_client return saml_client

@ -1,29 +1,29 @@
Flask==0.10.1 Flask==0.10.1
Flask-Bootstrap==3.3.2.1 Flask-Bootstrap==3.3.5.7
Flask-Login==0.2.11 Flask-Login==0.3.2
Jinja2==2.7.3 Jinja2==2.8
MarkupSafe==0.23 MarkupSafe==0.23
Paste==2.0.2 Paste==2.0.2
WebOb==1.4.1 WebOb==1.5.1
Werkzeug==0.10.4 Werkzeug==0.11.4
argparse==1.3.0 argparse==1.4.0
cffi==0.9.2 cffi==1.5.2
cryptography==0.9 cryptography==1.2.3
decorator==3.4.2 decorator==4.0.9
enum34==1.0.4 enum34==1.1.2
gunicorn==19.3.0 gunicorn==19.4.5
idna==1.1 idna==2.0
ipaddress==1.0.7 ipaddress==1.0.16
itsdangerous==0.24 itsdangerous==0.24
pyOpenSSL==0.15.1 pyOpenSSL==0.15.1
pyasn1==0.1.7 pyasn1==0.1.9
pycparser==2.13 pycparser==2.14
pycrypto==2.6.1 pycrypto==2.6.1
pysaml2==2.4.0 pysaml2==4.0.3
python-dateutil==2.4.2 python-dateutil==2.5.0
pytz==2015.4 pytz==2015.7
repoze.who==2.2 repoze.who==2.2
requests==2.7.0 requests==2.9.1
six==1.9.0 six==1.10.0
wsgiref==0.1.2 wsgiref==0.1.2
zope.interface==4.1.2 zope.interface==4.1.3

@ -16,7 +16,7 @@
</div> </div>
<div id="navbar" class="collapse navbar-collapse"> <div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
{% if current_user.is_authenticated() %} {% if current_user.is_authenticated %}
<li><a href="{{ url_for('logout') }}">Logout</a></li> <li><a href="{{ url_for('logout') }}">Logout</a></li>
{% endif %} {% endif %}
</ul> </ul>
@ -28,4 +28,3 @@
{% block content %} {% block content %}
</div> </div>
{% endblock %} {% endblock %}

@ -1,6 +1,6 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %} {% block content %}
{% if current_user.is_authenticated() %} {% if current_user.is_authenticated %}
<div class="container"> <div class="container">
<h1>Logged in</h1> <h1>Logged in</h1>
<p class="lead"> <p class="lead">

Loading…
Cancel
Save