Skip to content

Commit

Permalink
Django 2.x migration
Browse files Browse the repository at this point in the history
  • Loading branch information
peppelinux committed May 26, 2018
1 parent dbef8f0 commit fb0c490
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 27 deletions.
14 changes: 6 additions & 8 deletions djangosaml2idp/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from __future__ import absolute_import, division, print_function, unicode_literals

from django.conf.urls import url
from django.urls import path
from . import views

urlpatterns = [
url(r'^sso/post', views.sso_entry, name="saml_login_post"),
url(r'^sso/redirect', views.sso_entry, name="saml_login_redirect"),
url(r'^login/process/$', views.login_process, name='saml_login_process'),
url(r'^login/process_multi_factor/$', views.process_multi_factor, name='saml_multi_factor'),
url(r'^metadata/$', views.metadata, name='saml2_idp_metadata'),
path('sso/post', views.sso_entry, name="saml_login_post"),
path('sso/redirect', views.sso_entry, name="saml_login_redirect"),
path('login/process/', views.login_process, name='saml_login_process'),
path('login/process_multi_factor/', views.process_multi_factor, name='saml_multi_factor'),
path('metadata/', views.metadata, name='saml2_idp_metadata'),
]
6 changes: 3 additions & 3 deletions djangosaml2idp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.contrib.auth import logout
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.http import (HttpResponse, HttpResponseBadRequest,
HttpResponseRedirect, HttpResponseServerError)
from django.utils.datastructures import MultiValueDictKeyError
Expand Down Expand Up @@ -49,7 +49,7 @@ def sso_entry(request):
if "SigAlg" in passed_data and "Signature" in passed_data:
request.session['SigAlg'] = passed_data['SigAlg']
request.session['Signature'] = passed_data['Signature']
return HttpResponseRedirect(reverse('saml_login_process'))
return HttpResponseRedirect(reverse('djangosaml2idp:saml_login_process'))



Expand Down Expand Up @@ -157,7 +157,7 @@ def process_multi_factor(request, *args, **kwargs):
"""
logger.debug('In process_multi_factor view')

def check_other_factor(request.user):
def check_other_factor(request_user):
"""The code here can do whatever it needs to validate your user but must
return True for authentication to be considered a success"""
return True
Expand Down
9 changes: 4 additions & 5 deletions example_setup/idp/idp/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from django.conf.urls import url, include
from django.urls import include, path
from django.contrib import admin
from django.contrib.auth.views import login

import djangosaml2idp

urlpatterns = [
#url(r'^idp/', include('djangosaml2idp.urls')),
url(r'^idp/', include('djangosaml2idp.urls')),
url(r'^admin/', admin.site.urls),
url(r'^login/$', login, {'template_name': 'idp/login.html'}, name='login'),
#path('idp/', include('djangosaml2idp.urls')),
path('idp/', include('djangosaml2idp.urls')),
path('login/', login, {'template_name': 'idp/login.html'}, name='login'),
]
4 changes: 2 additions & 2 deletions example_setup/idp/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
django>=1.8
django>2.0,<2.1
djangosaml2idp==0.3.3
pysaml2>=4.4.0
pysaml2>=4.4.0
4 changes: 2 additions & 2 deletions example_setup/sp/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
django>=1.8
django>2.0,<2.1
djangosaml2==0.16.0
pysaml2>=4.4.0
pysaml2>=4.4.0
7 changes: 3 additions & 4 deletions example_setup/sp/sp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from . import views

urlpatterns = [
url(r'^$', views.index),
url(r'^logout/$', logout),
url(r'^saml2/', include('djangosaml2.urls')),
url(r'^admin/', admin.site.urls),
path('', views.index),
path('logout/', logout),
path('saml2/', include('djangosaml2.urls')),
]
2 changes: 1 addition & 1 deletion example_setup/sp/sp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def index(request):
""" Barebone 'diagnistics' view, print user attributes if logged in + login/logout links.
""" Barebone 'diagnostics' view, print user attributes if logged in + login/logout links.
"""
if request.user.is_authenticated:
out = "LOGGED IN: <a href={0}>LOGOUT</a><br>".format(settings.LOGOUT_URL)
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
django>=1.8
pysaml2>=4.4.0
django>2.0,<2.1
pysaml2>=4.4.0

0 comments on commit fb0c490

Please sign in to comment.