|
| 1 | +# Configuring SAML Group Mapping in NetBox Enterprise |
| 2 | + |
| 3 | +Setting up Group Mapping for SAML requires the [base SAML SSO Setup](./nbe-saml.md) to be configured and working first. |
| 4 | + |
| 5 | +## Configure the IdP |
| 6 | + |
| 7 | +NetBox Enterprise expects a SAML group attribute statement to be named `groups`, which contains a list of group names the user belongs to. If your IdP sends group information under a different attribute name, such as `MemberOf`, you must update its configuration to use `groups` to ensure proper mapping. |
| 8 | + |
| 9 | +Example: |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +## Configuring Group Mappings |
| 14 | + |
| 15 | +1. Desired groups must first be configured within NetBox |
| 16 | +2. In the Admin Console for NetBox Enterprise, navigate to the **Config** tab and scroll to the bottom to check **Advanced Settings** |
| 17 | +3. Apply the following into **NetBox Python Configuration Overrides**, replacing the relevant information. |
| 18 | + |
| 19 | +``` python |
| 20 | +SOCIAL_AUTH_PIPELINE = ( |
| 21 | +'social_core.pipeline.social_auth.social_details', |
| 22 | +'social_core.pipeline.social_auth.social_uid', |
| 23 | +'social_core.pipeline.social_auth.social_user', |
| 24 | +'social_core.pipeline.user.get_username', |
| 25 | +'social_core.pipeline.social_auth.associate_by_email', |
| 26 | +'social_core.pipeline.user.create_user', |
| 27 | +'social_core.pipeline.social_auth.associate_user', |
| 28 | +'netbox.authentication.user_default_groups_handler', |
| 29 | +'social_core.pipeline.social_auth.load_extra_data', |
| 30 | +'social_core.pipeline.user.user_details', |
| 31 | +'nbc_auth_extensions.saml_authentication.saml_map_groups', |
| 32 | +) |
| 33 | + |
| 34 | +SOCIAL_AUTH_PIPELINE_CONFIG = { |
| 35 | + 'SAML_USER_FLAGS_BY_GROUP': { |
| 36 | + "is_staff": { |
| 37 | + "idp-staff-group-name" # remove this line if no group should be granted 'Staff' |
| 38 | + }, |
| 39 | + "is_superuser": { |
| 40 | + "idp-superuser-group-name" # remove this line if no group should be granted 'Superuser' |
| 41 | + } |
| 42 | + }, |
| 43 | + 'SAML_GROUP_MAP': { |
| 44 | + "idp-group-name-1": "netbox-group-name-1", |
| 45 | + "idp-group-name-2": "netbox-group-name-2" |
| 46 | + } |
| 47 | +} |
| 48 | +``` |
| 49 | + |
0 commit comments