from django import forms
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
class LoginForm(forms.Form):
from django.conf import settings
from django.db import models
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from random import Random
import string
from urllib.parse import urlencode, urlparse, parse_qs, ParseResult
abstract = True
def __init__(self, *args, **kwargs):
- if 'ticket' not in kwargs:
- kwargs['ticket'] = self._generate_ticket()
super(BaseTicket, self).__init__(*args, **kwargs)
+ if not self.ticket:
+ self.ticket = self._generate_ticket()
def __unicode__(self):
return self.ticket
prefix = 'PGT'
def __init__(self, *args, **kwargs):
- if 'pgtiou' not in kwargs:
- kwargs['pgtiou'] = "PGTIOU-%s" % (''.join(Random().sample(string.ascii_letters + string.digits, 50)))
super(ProxyGrantingTicket, self).__init__(*args, **kwargs)
+ if not self.pgtiou:
+ self.pgtiou = "PGTIOU-%s" % (''.join(Random().sample(string.ascii_letters + string.digits, 50)))
class Meta:
verbose_name = _('Proxy Granting Ticket')
from django import dispatch
-on_cas_collect_histories = dispatch.Signal(providing_args=["for_email"])
+on_cas_collect_histories = dispatch.Signal()
-on_cas_login = dispatch.Signal(providing_args=["request"])
+on_cas_login = dispatch.Signal()
-on_cas_login_success = dispatch.Signal(providing_args=["user", "service"])
+on_cas_login_success = dispatch.Signal()
-cas_collect_custom_attributes = dispatch.Signal(providing_args=['user'])
+cas_collect_custom_attributes = dispatch.Signal()
-from django.conf.urls import url
+from django.urls import path
from cas_provider import views
urlpatterns = [
- url(r'^login/merge/', views.login, {'merge': True, 'template_name': 'cas/merge.html'}),
- url(r'^login/?$', views.login, name='cas_login'),
- url(r'^socialauth-login/$', views.login, name='cas_socialauth_login'),
- url(r'^validate/?$', views.validate, name='cas_validate'),
- url(r'^proxy/?$', views.proxy, name='proxy'),
- url(r'^serviceValidate/?$', views.service_validate, name='cas_service_validate'),
- url(r'^proxyValidate/?$', views.proxy_validate, name='cas_proxy_validate'),
- url(r'^logout/?$', views.logout, name='cas_logout'),
+ path('login/merge/', views.login, {'merge': True, 'template_name': 'cas/merge.html'}),
+ path('login/', views.login, name='cas_login'),
+ path('socialauth-login/', views.login, name='cas_socialauth_login'),
+ path('validate/', views.validate, name='cas_validate'),
+ path('proxy/', views.proxy, name='proxy'),
+ path('serviceValidate/', views.service_validate, name='cas_service_validate'),
+ path('proxyValidate/', views.proxy_validate, name='cas_proxy_validate'),
+ path('logout/', views.logout, name='cas_logout'),
]
from django.contrib.auth import login as auth_login, logout as auth_logout
from django.shortcuts import render
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.template import RequestContext
from django.contrib.auth import authenticate
-from django.utils.translation import ugettext as _
from lxml import etree
from cas_provider.attribute_formatters import NSMAP, CAS
-from django.conf.urls import include, url
+from django.urls import path, include
from django.contrib import admin
from django.views.generic import TemplateView
from django import VERSION
-if VERSION >= (2,):
- from django.urls import path
-
urlpatterns = [
- url(r'^admin/', include(admin.site.urls)) if VERSION < (2,) else path('admin/', admin.site.urls),
- url(r'^', include('cas_provider.urls')),
- url(r'^accounts/profile', TemplateView.as_view(template_name='login-success-redirect-target.html')),
+ path('admin/', admin.site.urls),
+ path('', include('cas_provider.urls')),
+ path('accounts/profile/', TemplateView.as_view(template_name='login-success-redirect-target.html')),
]
setup(
name='django-cas-provider',
- version='22.4',
+ version='23.3',
description='A "provider" for the Central Authentication Service (http://jasig.org/cas)',
author='(Chris Williams), Sebastian Annies',
author_email='(chris@nitron.org), sebastian.annies@googlemail.com',
long_description=read('README.rst'),
zip_safe=False,
install_requires=[
- 'Django>=1.11,<4.1',
+ 'Django>=2.0,<4.2',
'lxml',
],
classifiers = [
[tox]
envlist=clear,
- d111-py{37},
d20-py{37},
d21-py{37},
d22-py{37,38,39},
d{30,31}-py{37,38,39},
d32-py{37,38,39,310},
d40-py{38,39,310},
+ d41-py{38,39,310,311},
stats
[testenv]
d31: Django>=3.1,<3.2
d32: Django>=3.2,<4.0
d40: Django>=4.0,<4.1
+ d41: Django>=4.1,<4.2
coverage
usedevelop=True