Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
0cb4a07f
Commit
0cb4a07f
authored
Oct 27, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #897 from quinox/auth_cas
Document CAS authentication
parents
98a2ad17
bffe6b9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
0 deletions
+59
-0
docs/admin/auth.rst
docs/admin/auth.rst
+59
-0
No files found.
docs/admin/auth.rst
View file @
0cb4a07f
...
@@ -170,3 +170,62 @@ Once you have the package installed, you can hook it to Django authentication:
...
@@ -170,3 +170,62 @@ Once you have the package installed, you can hook it to Django authentication:
}
}
.. seealso:: http://pythonhosted.org/django-auth-ldap/
.. seealso:: http://pythonhosted.org/django-auth-ldap/
CAS authentication
++++++++++++++++++
CAS authentication can be achieved using a package such as `django-cas-ng`.
Step one is disclosing the email field of the user via CAS. This has to be
configured on the CAS server itself and requires you run at least CAS v2 since
CAS v1 doesn't support attributes at all.
Step two is updating Weblate to use your CAS server and attributes.
To install `django-cas-ng`:
.. code-block:: sh
pip install django-cas-ng
Once you have the package installed you can hook it up to the Django
authentication system by modifying the :file:`settings.py` file:
.. code-block:: python
# Add CAS backed, keep Django one if you want to be able to login
# even without LDAP for admin account
AUTHENTICATION_BACKENDS = (
'django_cas_ng.backends.CASBackend',
'weblate.accounts.auth.WeblateUserBackend',
)
# CAS server address
CAS_SERVER_URL = 'https://cas.example.net/cas/'
# Add django_cas_ng somewhere in the list of INSTALLED_APPS
INSTALLED_APPS = (
...,
'django_cas_ng'
)
Finally, a signal can be used to map the email field to the user object. For
this to work you have to import the signal from the `django-cas-ng` package and
connect your code with this signal. Doing this inside your settings file can
cause problems, therefore it's suggested to put it:
- in your app config's `ready <https://docs.djangoproject.com/en/dev/ref/applications/#django.apps.AppConfig.ready>` method (Django 1.7 and higher)
- at the end of your :file:`models.py` file (Django 1.6 and lower)
- in the project's :file:`urls.py` file (when no models exist)
.. code-block:: python
from django_cas_ng.signals import cas_user_authenticated
from django.dispatch import receiver
@receiver(cas_user_authenticated)
def update_user_email_address(sender, user=None, attributes=None, **kwargs):
# If your CAS server does not always include the email attribute
# you can wrap the next two lines of code in a try/catch block.
user.email = attributes['email']
user.save()
.. seealso:: https://github.com/mingchen/django-cas-ng
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment