Hi, this is quick setup guide for using django-cas-client (1.2.0) with Wagtail, gave me a few headaches so maybe this can help someone else.
I’m assuming you have a CAS authentication server setup already, this guide doesn’t cover that.
First off you’ll need to install the django-cas-client, I did this by adding a line in my requirements.txt of :
Then in your settings file, make sure you add a backend like :
AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'cas.backends.CASBackend', )
CAS_SERVER_URL = 'https://login.yourserveraddresstocas.com/cas/' CAS_REDIRECT_URL = '/admin/' CAS_AUTO_CREATE_USER = False
(The auto create setting is really important otherwise the CAS client will attempt to make a user in Wagtail with no details, this will cause a redirect loop on login for authenticated users)
to the MIDDLEWARE_CLASSES section
to the list of installed apps.
That’s all for settings, next open up your urls.py and add these lines :
url(r'^admin/login/$', 'cas.views.login', name='login'), url(r'^admin/logout/$', 'cas.views.logout', name='logout'),
That should be it, any problems comment below!