Skip to main content

Kleides Discourse SSO client for Django

Project description

Discourse Single-Sign-on (DSSO) provider client to connect your Django project to a Discourse Single-Sign-On provider server.


Example usage:

  • Add kleides_dssoclient to INSTALLED_APPS.

  • Create a custom DssoLoginBackend, for example:

    from kleides_dssoclient.backends import DssoLoginBackend
    class MyProjectDssoLoginBackend(DssoLoginBackend):
        DssoLoginBackend that rejects anyone without is_superuser, and that
        sets all mapped variables on the newly created User object.
        def authenticate(self, dsso_mapping):
            Check that user is a superuser and pass along to DssoLoginBackend.
            if dsso_mapping.get('is_superuser') not in ('True', 'true', '1'):
                return None
            return super(MyProjectDssoLoginBackend, self).authenticate(
        def configure_user(self, user, dsso_mapping):
            We expect username, email, is_superuser in the dsso_mapping.
            user = (
                super(MyProjectDssoLoginBackend, self)
                .configure_user(user, dsso_mapping))
   = dsso_mapping.get('email', '')
            is_superuser = (
                dsso_mapping.get('is_superuser') in ('True', 'true', '1'))
            user.is_staff = is_superuser
            user.is_superuser = is_superuser
            return user
  • Add this to the Django settings:

    AUTHENTICATION_BACKENDS = (  # the only backend needed
    KLEIDES_DSSOCLIENT_SHARED_KEY = 'oh-sso-very-very-secret'


v0.3 - 2018-12-18

  • Add support for Django 1.10 style middleware.
  • Check Django version for is_authenticated usage.

v0.2 - 2018-11-19

  • Replace sso_mapping with dsso_mapping in authenticate argument list.

v0.1 - 2018-11-16

  • Initial release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for kleides-dssoclient, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size kleides_dssoclient-0.3.tar.gz (19.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page