Skip to content

Commit c06cf84

Browse files
authored
Class-based views rework (#216)
1 parent 3f27613 commit c06cf84

File tree

5 files changed

+195
-249
lines changed

5 files changed

+195
-249
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ following url::
634634
# lots of url definitions here
635635

636636
(r'^saml2/', include('djangosaml2.urls')),
637-
(r'^test/', 'djangosaml2.views.echo_attributes'),
637+
(r'^test/', 'djangosaml2.views.EchoAttributesView.as_view()'),
638638

639639
# more url definitions
640640
)

djangosaml2/tests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ def test_custom_conf_loader_from_view(self):
729729
saml_session_name = getattr(settings, 'SAML_SESSION_COOKIE_NAME', 'saml_session')
730730
getattr(request, saml_session_name).save()
731731

732-
response = views.login(request, config_loader_path)
732+
response = views.LoginView.as_view(config_loader_path=config_loader_path)(request)
733733
self.assertEqual(response.status_code, 302)
734734
location = response['Location']
735735

djangosaml2/urls.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
urlpatterns = [
2121
path('login/', views.LoginView.as_view(), name='saml2_login'),
2222
path('acs/', views.AssertionConsumerServiceView.as_view(), name='saml2_acs'),
23-
path('logout/', views.logout, name='saml2_logout'),
24-
path('ls/', views.logout_service, name='saml2_ls'),
25-
path('ls/post/', views.logout_service_post, name='saml2_ls_post'),
23+
path('logout/', views.LogoutInitView.as_view(), name='saml2_logout'),
24+
path('ls/', views.LogoutView.as_view(), name='saml2_ls'),
25+
path('ls/post/', views.LogoutView.as_view(), name='saml2_ls_post'),
2626
path('metadata/', views.MetadataView.as_view(), name='saml2_metadata'),
2727
]

djangosaml2/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ def validate_referral_url(request, url):
9999

100100
if not is_safe_url(url=url, allowed_hosts=saml_allowed_hosts):
101101
return settings.LOGIN_REDIRECT_URL
102-
else:
103-
return url
102+
return url
104103

105104

106105
def saml2_from_httpredirect_request(url):

0 commit comments

Comments
 (0)