Skip to main content

Social Auth pipeline for use with OIDC SSO and Apereo CAS

Project description

Apereo CAS pipeline for Django Social Auth

When using SSO with Netbox is it not normally possible to have groups syncronized. This pipeline for Django Social Auth takes the data in the OIDC response from Apereo CAS and extracts the "memberOf" field and adds the user to those groups, creating any missing groups in the process.

It is also possible to configure certain groups to grant staff and superuser permessions to a user, based on group membership.

Usage

Add the pipeline to the SOCIAL_AUTH_PIPELINE variable, e.g. if you using the standard pipelines, if in doubt, then you most likely are, simply add the following to you Netbox config:

SOCIAL_AUTH_PIPELINE = (
    'social_core.pipeline.social_auth.social_details',
    'social_core.pipeline.social_auth.social_uid',
    'social_core.pipeline.social_auth.social_user',
    'social_core.pipeline.user.get_username',
    'social_core.pipeline.social_auth.associate_by_email',
    'social_core.pipeline.user.create_user',
    'social_core.pipeline.social_auth.associate_user',
    'netbox.authentication.user_default_groups_handler',
    'social_core.pipeline.social_auth.load_extra_data',
    'social_core.pipeline.user.user_details',
    'apereo.pipelines.groups.add_user_to_groups',
)

With "apereo.pipeline.groups.add_user_to_groups" being the module path to the actual pipeline.

Configuration

In some cases it's not required or even desirable to syncronize all groups returned by Apereo CAS. You can limit the group you want by setting SOCIAL_AUTH_ALLOW_GROUPS. See example below. This will ensure that only the listed groups are created and associated to users.

SOCIAL_AUTH_ALLOW_GROUPS = ['ops', 'staff']

The pipeline can automatically assign staff and superuser priviledges if configured. Set the two standard Netbox configuration variables:

  • REMOTE_AUTH_SUPERUSER_GROUPS
  • REMOTE_AUTH_STAFF_GROUPS

These can be a string or an array of string.

REMOTE_AUTH_SUPERUSER_GROUPS = ['ops', 'wmf']
REMOTE_AUTH_STAFF_GROUPS = 'wmf'

If a user is a member of the listed groups the pipeline will ensure that the user attributes "is_superuser" and "is_staff" is set to True.

Project details


Download files

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

Source Distribution

apereosocialpipeline-0.0.4.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apereosocialpipeline-0.0.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file apereosocialpipeline-0.0.4.tar.gz.

File metadata

  • Download URL: apereosocialpipeline-0.0.4.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for apereosocialpipeline-0.0.4.tar.gz
Algorithm Hash digest
SHA256 b527bc30e01203aa6cb98e1167a00e32b0e3de5d9292574f7b0d75494f5b0b29
MD5 34ea690a0a47f0d11872b02c744f6279
BLAKE2b-256 7635178b4d96409248f2e5be9da44641e1d4e5ef2ad5a03ba0e213cd14734ee9

See more details on using hashes here.

File details

Details for the file apereosocialpipeline-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for apereosocialpipeline-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 007f98dbdfea5c432cc90298a5576c4fe22dee7f81d0850afd5fdcb4784ac30c
MD5 94cc97a283213e33acd5604270939d18
BLAKE2b-256 290537247a4357d7abf2066c88a0bad7a31c06caafe409e6061306581a62516f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page