From 17e499e11f9724f05c9f2ac0d2ba39a5e4295fe1 Mon Sep 17 00:00:00 2001 From: babolivier Date: Thu, 22 Jul 2021 10:58:46 +0000 Subject: deploy: d518b05a8667943bd0aa9ab1edc91eec0a8283fe --- develop/development/cas.html | 317 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 develop/development/cas.html (limited to 'develop/development/cas.html') diff --git a/develop/development/cas.html b/develop/development/cas.html new file mode 100644 index 0000000000..b67bd6d383 --- /dev/null +++ b/develop/development/cas.html @@ -0,0 +1,317 @@ + + + + + + CAS - Synapse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+ +
+ +
+ +

How to test CAS as a developer without a server

+

The django-mama-cas project is an +easy to run CAS implementation built on top of Django.

+

Prerequisites

+
    +
  1. Create a new virtualenv: python3 -m venv <your virtualenv>
  2. +
  3. Activate your virtualenv: source /path/to/your/virtualenv/bin/activate
  4. +
  5. Install Django and django-mama-cas: +
    python -m pip install "django<3" "django-mama-cas==2.4.0"
    +
    +
  6. +
  7. Create a Django project in the current directory: +
    django-admin startproject cas_test .
    +
    +
  8. +
  9. Follow the install directions for django-mama-cas
  10. +
  11. Setup the SQLite database: python manage.py migrate
  12. +
  13. Create a user: +
    python manage.py createsuperuser
    +
    +
      +
    1. Use whatever you want as the username and password.
    2. +
    3. Leave the other fields blank.
    4. +
    +
  14. +
  15. Use the built-in Django test server to serve the CAS endpoints on port 8000: +
    python manage.py runserver
    +
    +
  16. +
+

You should now have a Django project configured to serve CAS authentication with +a single user created.

+

Configure Synapse (and Element) to use CAS

+
    +
  1. Modify your homeserver.yaml to enable CAS and point it to your locally +running Django test server: +
    cas_config:
    +  enabled: true
    +  server_url: "http://localhost:8000"
    +  service_url: "http://localhost:8081"
    +  #displayname_attribute: name
    +  #required_attributes:
    +  #    name: value
    +
    +
  2. +
  3. Restart Synapse.
  4. +
+

Note that the above configuration assumes the homeserver is running on port 8081 +and that the CAS server is on port 8000, both on localhost.

+

Testing the configuration

+

Then in Element:

+
    +
  1. Visit the login page with a Element pointing at your homeserver.
  2. +
  3. Click the Single Sign-On button.
  4. +
  5. Login using the credentials created with createsuperuser.
  6. +
  7. You should be logged in.
  8. +
+

If you want to repeat this process you'll need to manually logout first:

+
    +
  1. http://localhost:8000/admin/
  2. +
  3. Click "logout" in the top right.
  4. +
+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit 1.4.1