Skip to content

Commit e98b5bb

Browse files
paulOsinskivalentijnscholten
authored andcommitted
[docs] split SSO config up, fix CSS issue (DefectDojo#14431)
* add SAML group mapping instructions * split SSO articles * fix scroll overflow
1 parent 1a56de6 commit e98b5bb

22 files changed

+986
-0
lines changed

docs/assets/scss/common/_custom.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,30 @@ h1, h2, h3, h4, h5, h6,
9898
visibility: hidden; // Hide sidebar until version is resolved
9999
}
100100

101+
@media (min-width: 992px) {
102+
@supports ((position: -webkit-sticky) or (position: sticky)) {
103+
.docs-sidebar {
104+
display: flex !important; // Override Bootstrap d-lg-block { display: block !important }
105+
flex-direction: column;
106+
}
107+
108+
.docs-version-toggle {
109+
flex-shrink: 0;
110+
}
111+
112+
.version-menu-wrapper {
113+
flex: 1;
114+
min-height: 0; // Required: allows flex child to shrink below content size
115+
overflow-y: auto;
116+
}
117+
118+
.docs-links {
119+
max-height: none; // Parent flex container now handles height/scroll
120+
overflow: visible;
121+
}
122+
}
123+
}
124+
101125
.doks-sidebar .section-nav a {
102126
color: #333333; // Dojo Hue 04
103127
transition: color 0.15s ease, background-color 0.15s ease;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: "Auth0"
3+
description: "Configure Auth0 SSO in Open-Source DefectDojo"
4+
weight: 4
5+
audience: opensource
6+
---
7+
8+
Open-Source DefectDojo supports login via Auth0. DefectDojo Pro users should refer to the [Pro Auth0 guide](../PRO__auth0/).
9+
10+
## Prerequisites
11+
12+
Complete the following steps in your Auth0 dashboard before configuring DefectDojo:
13+
14+
1. Create a new application: **Applications > Create Application > Single Page Web Application**.
15+
16+
2. Configure the application:
17+
- **Name:** `DefectDojo`
18+
- **Allowed Callback URLs:** `https://your-instance.cloud.defectdojo.com/complete/auth0/`
19+
20+
3. Note the following values — you will need them in DefectDojo:
21+
- **Domain**
22+
- **Client ID**
23+
- **Client Secret**
24+
25+
## Configuration
26+
27+
Set the following as environment variables, or without the `DD_` prefix in your `local_settings.py` file (see [Configuration](/get_started/open_source/configuration/)):
28+
29+
{{< highlight python >}}
30+
DD_SOCIAL_AUTH_AUTH0_OAUTH2_ENABLED=True
31+
DD_SOCIAL_AUTH_AUTH0_KEY=(str, 'YOUR_CLIENT_ID'),
32+
DD_SOCIAL_AUTH_AUTH0_SECRET=(str, 'YOUR_CLIENT_SECRET'),
33+
DD_SOCIAL_AUTH_AUTH0_DOMAIN=(str, 'YOUR_AUTH0_DOMAIN'),
34+
{{< /highlight >}}
35+
36+
Restart DefectDojo. A **Login with Auth0** button will appear on the login page.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: "Azure Active Directory"
3+
description: "Configure Azure AD SSO and group mapping in Open-Source DefectDojo"
4+
weight: 6
5+
audience: opensource
6+
---
7+
8+
Open-Source DefectDojo supports login via Azure Active Directory (Azure AD), including automatic User Group synchronization. DefectDojo Pro users should refer to the [Pro Azure AD guide](../PRO__azure_ad/).
9+
10+
## Prerequisites
11+
12+
Complete the following steps in the Azure portal before configuring DefectDojo:
13+
14+
1. [Register a new app](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app) in Azure Active Directory.
15+
16+
2. Note the following values from the registered app:
17+
- **Application (client) ID**
18+
- **Directory (tenant) ID**
19+
- Under **Certificates & Secrets**, create a new **Client Secret** and note its value
20+
21+
3. Under **Authentication > Redirect URIs**, add a **Web** type URI:
22+
`https://your-instance.cloud.defectdojo.com/complete/azuread-tenant-oauth2/`
23+
24+
## Configuration
25+
26+
Set the following as environment variables, or without the `DD_` prefix in your `local_settings.py` file (see [Configuration](/get_started/open_source/configuration/)):
27+
28+
{{< highlight python >}}
29+
DD_SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_KEY=(str, 'YOUR_APPLICATION_ID'),
30+
DD_SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_SECRET=(str, 'YOUR_CLIENT_SECRET'),
31+
DD_SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_TENANT_ID=(str, 'YOUR_DIRECTORY_ID'),
32+
DD_SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_ENABLED=True
33+
{{< /highlight >}}
34+
35+
Restart DefectDojo. A **Login with Azure AD** button will appear on the login page.
36+
37+
## Group Mapping
38+
39+
To import User Group membership from Azure AD, set the following variable:
40+
41+
{{< highlight python >}}
42+
DD_SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_GET_GROUPS=True
43+
{{< /highlight >}}
44+
45+
On login, DefectDojo will assign the user to all groups found in the Azure AD token. Any groups not found in DefectDojo will be created automatically. This allows product access to be governed via groups.
46+
47+
### Configuring Azure AD to send groups
48+
49+
The Azure AD token must be configured to include group IDs. Without this, no group information will be present in the token.
50+
51+
To configure this:
52+
1. Add a [Group Claim](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-fed-group-claims) to the token. If unsure which group type to select, choose **All Groups**.
53+
2. Do **not** enable **Emit groups as role claims**.
54+
3. Update the application's API permissions to include `GroupMember.Read.All` or `Group.Read.All`. `GroupMember.Read.All` is recommended as it grants fewer permissions.
55+
56+
### Filtering groups
57+
58+
To limit which groups are imported, use a regex filter:
59+
60+
{{< highlight python >}}
61+
DD_SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_GROUPS_FILTER='^team-.*' # or 'teamA|teamB|groupC'
62+
{{< /highlight >}}
63+
64+
### Automatic Group Cleanup
65+
66+
To remove stale groups when users are removed from them in Azure AD:
67+
68+
{{< highlight python >}}
69+
DD_SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_CLEANUP_GROUPS=True
70+
{{< /highlight >}}
71+
72+
When a user is removed from a group in Azure AD, they are also removed from the corresponding group in DefectDojo. Empty groups are left in place for record purposes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: "GitHub Enterprise"
3+
description: "Configure GitHub Enterprise SSO in Open-Source DefectDojo"
4+
weight: 8
5+
audience: opensource
6+
---
7+
8+
Open-Source DefectDojo supports login via GitHub Enterprise. DefectDojo Pro users should refer to the [Pro GitHub Enterprise guide](../PRO__github_enterprise/).
9+
10+
## Prerequisites
11+
12+
Complete the following steps in GitHub Enterprise before configuring DefectDojo:
13+
14+
1. [Create a new OAuth App](https://docs.github.com/en/enterprise-server/developers/apps/building-oauth-apps/creating-an-oauth-app) in your GitHub Enterprise Server.
15+
16+
2. Choose a name for the application, e.g. `DefectDojo`.
17+
18+
3. Set the **Redirect URI**:
19+
`https://your-dojo-host:your-port/complete/github-enterprise/`
20+
21+
4. Note the **Client ID** and **Client Secret** from the app.
22+
23+
## Configuration
24+
25+
Set the following as environment variables, or without the `DD_` prefix in your `local_settings.py` file (see [Configuration](/get_started/open_source/configuration/)):
26+
27+
{{< highlight python >}}
28+
DD_SOCIAL_AUTH_GITHUB_ENTERPRISE_KEY=(str, 'YOUR_CLIENT_ID'),
29+
DD_SOCIAL_AUTH_GITHUB_ENTERPRISE_SECRET=(str, 'YOUR_CLIENT_SECRET'),
30+
DD_SOCIAL_AUTH_GITHUB_ENTERPRISE_URL=(str, 'https://github.yourcompany.com/'),
31+
DD_SOCIAL_AUTH_GITHUB_ENTERPRISE_API_URL=(str, 'https://github.yourcompany.com/api/v3/'),
32+
DD_SOCIAL_AUTH_GITHUB_ENTERPRISE_OAUTH2_ENABLED=True,
33+
{{< /highlight >}}
34+
35+
Restart DefectDojo. A **Login with GitHub Enterprise** button will appear on the login page.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "GitLab"
3+
description: "Configure GitLab SSO in Open-Source DefectDojo"
4+
weight: 10
5+
audience: opensource
6+
---
7+
8+
Open-Source DefectDojo supports login via GitLab. DefectDojo Pro users should refer to the [Pro GitLab guide](../PRO__gitlab/).
9+
10+
## Prerequisites
11+
12+
Complete the following steps in GitLab before configuring DefectDojo:
13+
14+
1. Navigate to your GitLab profile's Applications page:
15+
- GitLab.com: `https://gitlab.com/profile/applications`
16+
- Self-hosted: `https://your-gitlab-host/profile/applications`
17+
18+
2. Create a new application:
19+
- **Name:** `DefectDojo`
20+
- **Redirect URI:** `https://your-dojo-host/complete/gitlab/`
21+
22+
3. Note the **Application ID** and **Secret** from the application.
23+
24+
## Configuration
25+
26+
Set the following as environment variables, or without the `DD_` prefix in your `local_settings.py` file (see [Configuration](/get_started/open_source/configuration/)):
27+
28+
{{< highlight python >}}
29+
DD_SOCIAL_AUTH_GITLAB_KEY=(str, 'YOUR_APPLICATION_ID'),
30+
DD_SOCIAL_AUTH_GITLAB_SECRET=(str, 'YOUR_SECRET'),
31+
DD_SOCIAL_AUTH_GITLAB_API_URL=(str, 'https://gitlab.com'),
32+
DD_SOCIAL_AUTH_GITLAB_OAUTH2_ENABLED=True
33+
{{< /highlight >}}
34+
35+
Restart DefectDojo. A **Login with GitLab** button will appear on the login page.
36+
37+
### Auto-importing GitLab projects
38+
39+
To automatically import your GitLab projects as DefectDojo Products, add the following variable:
40+
41+
{{< highlight python >}}
42+
DD_SOCIAL_AUTH_GITLAB_PROJECT_AUTO_IMPORT=True
43+
{{< /highlight >}}
44+
45+
**Note:** Enabling this on an existing instance with a GitLab integration will require users to re-grant the `read_repository` permission.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: "Google Auth"
3+
description: "Configure Google OAuth in Open-Source DefectDojo"
4+
weight: 12
5+
audience: opensource
6+
---
7+
8+
Open-Source DefectDojo supports login via Google accounts. New users are created automatically on first login if they don't already exist. Existing DefectDojo users are matched to Google accounts by username (the portion before the `@` in their Google email). DefectDojo Pro users should refer to the [Pro Google guide](../PRO__google/).
9+
10+
## Prerequisites
11+
12+
Complete the following steps in the Google Cloud Console before configuring DefectDojo:
13+
14+
1. Sign in to the [Google Developers Console](https://console.developers.google.com).
15+
16+
2. Go to **Credentials > Create Credentials > OAuth Client ID**.
17+
18+
3. Select **Web Application** and give it a descriptive name (e.g. `DefectDojo`).
19+
20+
4. Under **Authorized Redirect URIs**, add:
21+
`https://your-dojo-host/complete/google-oauth2/`
22+
23+
5. Note the **Client ID** and **Client Secret Key**.
24+
25+
## Configuration
26+
27+
Set the following as environment variables, or without the `DD_` prefix in your `local_settings.py` file (see [Configuration](/get_started/open_source/configuration/)):
28+
29+
{{< highlight python >}}
30+
DD_SOCIAL_AUTH_GOOGLE_OAUTH2_ENABLED=True,
31+
DD_SOCIAL_AUTH_GOOGLE_OAUTH2_KEY=(str, 'YOUR_CLIENT_ID'),
32+
DD_SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET=(str, 'YOUR_CLIENT_SECRET'),
33+
{{< /highlight >}}
34+
35+
You must also authorize which users can log in. You can whitelist by domain:
36+
37+
{{< highlight python >}}
38+
DD_SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS=['example.com', 'example.org']
39+
{{< /highlight >}}
40+
41+
Or as an environment variable (comma-separated):
42+
43+
{{< highlight python >}}
44+
DD_SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS=example.com,example.org
45+
{{< /highlight >}}
46+
47+
Alternatively, whitelist specific email addresses:
48+
49+
{{< highlight python >}}
50+
DD_SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_EMAILS=['user@example.com']
51+
{{< /highlight >}}
52+
53+
Or as an environment variable:
54+
55+
{{< highlight python >}}
56+
DD_SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_EMAILS=user@example.com,user2@example.com
57+
{{< /highlight >}}
58+
59+
Restart DefectDojo. A **Login With Google** button will appear on the login page.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: "KeyCloak"
3+
description: "Configure KeyCloak SSO in Open-Source DefectDojo"
4+
weight: 14
5+
audience: opensource
6+
---
7+
8+
Open-Source DefectDojo supports login via KeyCloak. DefectDojo Pro users should refer to the [Pro KeyCloak guide](../PRO__keycloak/).
9+
10+
This guide assumes you already have a KeyCloak Realm configured. If not, see the [KeyCloak documentation](https://wjw465150.gitbooks.io/keycloak-documentation/content/server_admin/topics/realms/create.html).
11+
12+
## Prerequisites
13+
14+
Complete the following steps in your KeyCloak realm before configuring DefectDojo:
15+
16+
1. Add a new client with type `openid-connect`. Note the client ID.
17+
18+
2. In the client settings:
19+
- Set **Access Type** to `confidential`
20+
- Under **Valid Redirect URIs**, add your DefectDojo URL, e.g. `https://your-dojo-host/*`
21+
- Under **Web Origins**, add the same URL (or `+`)
22+
- Under **Fine Grained OpenID Connect Configuration**:
23+
- Set **User Info Signed Response Algorithm** to `RS256`
24+
- Set **Request Object Signature Algorithm** to `RS256`
25+
- Save the settings.
26+
27+
3. Under **Scope**, set **Full Scope Allowed** to `off`.
28+
29+
4. Under **Mappers**, add a custom mapper:
30+
- **Name:** `aud`
31+
- **Mapper Type:** `audience`
32+
- **Included Audience:** select your client ID
33+
- **Add ID to Token:** `off`
34+
- **Add Access to Token:** `on`
35+
36+
5. Under **Credentials**, copy the **Secret**.
37+
38+
6. In **Realm Settings > Keys**, copy the **Public Key** (signing key).
39+
40+
7. In **Realm Settings > General > Endpoints**, open the OpenID endpoint configuration and copy the **Authorization** and **Token** endpoint URLs.
41+
42+
## Configuration
43+
44+
Set the following as environment variables, or without the `DD_` prefix in your `local_settings.py` file (see [Configuration](/get_started/open_source/configuration/)):
45+
46+
{{< highlight python >}}
47+
DD_SESSION_COOKIE_SECURE=True,
48+
DD_CSRF_COOKIE_SECURE=True,
49+
DD_SECURE_SSL_REDIRECT=True,
50+
DD_SOCIAL_AUTH_KEYCLOAK_OAUTH2_ENABLED=True,
51+
DD_SOCIAL_AUTH_KEYCLOAK_PUBLIC_KEY=(str, 'YOUR_REALM_PUBLIC_KEY'),
52+
DD_SOCIAL_AUTH_KEYCLOAK_KEY=(str, 'YOUR_CLIENT_ID'),
53+
DD_SOCIAL_AUTH_KEYCLOAK_SECRET=(str, 'YOUR_CLIENT_SECRET'),
54+
DD_SOCIAL_AUTH_KEYCLOAK_AUTHORIZATION_URL=(str, 'YOUR_AUTHORIZATION_ENDPOINT'),
55+
DD_SOCIAL_AUTH_KEYCLOAK_ACCESS_TOKEN_URL=(str, 'YOUR_TOKEN_ENDPOINT')
56+
{{< /highlight >}}
57+
58+
For Helm deployments, add the following to the `extraConfig` section:
59+
60+
```yaml
61+
DD_SESSION_COOKIE_SECURE: 'True'
62+
DD_CSRF_COOKIE_SECURE: 'True'
63+
DD_SECURE_SSL_REDIRECT: 'True'
64+
DD_SOCIAL_AUTH_KEYCLOAK_OAUTH2_ENABLED: 'True'
65+
DD_SOCIAL_AUTH_KEYCLOAK_PUBLIC_KEY: '<your realm public key>'
66+
DD_SOCIAL_AUTH_KEYCLOAK_KEY: '<your client id>'
67+
DD_SOCIAL_AUTH_KEYCLOAK_SECRET: '<your keycloak client credentials secret>'
68+
DD_SOCIAL_AUTH_KEYCLOAK_AUTHORIZATION_URL: '<your authorization endpoint>'
69+
DD_SOCIAL_AUTH_KEYCLOAK_ACCESS_TOKEN_URL: '<your token endpoint>'
70+
```
71+
72+
Optionally, set `DD_SOCIAL_AUTH_KEYCLOAK_LOGIN_BUTTON_TEXT` to customize the login button text.
73+
74+
Restart DefectDojo. A login button will appear on the login page with your configured text.

docs/content/admin/sso/OS__oidc.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "OIDC"
3+
description: "Configure OpenID Connect (OIDC) SSO in Open-Source DefectDojo"
4+
weight: 18
5+
audience: opensource
6+
---
7+
8+
Open-Source DefectDojo supports login via a generic OpenID Connect (OIDC) provider. DefectDojo Pro users should refer to the [Pro OIDC guide](../PRO__oidc/).
9+
10+
## Configuration
11+
12+
Set the following required variables as environment variables, or without the `DD_` prefix in your `local_settings.py` file (see [Configuration](/get_started/open_source/configuration/)):
13+
14+
{{< highlight python >}}
15+
DD_SOCIAL_AUTH_OIDC_AUTH_ENABLED=True,
16+
DD_SOCIAL_AUTH_OIDC_OIDC_ENDPOINT=(str, 'https://your-oidc-provider.com'),
17+
DD_SOCIAL_AUTH_OIDC_KEY=(str, 'YOUR_CLIENT_ID'),
18+
DD_SOCIAL_AUTH_OIDC_SECRET=(str, 'YOUR_CLIENT_SECRET')
19+
{{< /highlight >}}
20+
21+
The remaining OIDC configuration is auto-detected by fetching:
22+
`<DD_SOCIAL_AUTH_OIDC_OIDC_ENDPOINT>/.well-known/openid-configuration`
23+
24+
Restart DefectDojo. A **Log In With OIDC** button will appear on the login page.
25+
26+
## Optional Variables
27+
28+
{{< highlight python >}}
29+
DD_SOCIAL_AUTH_OIDC_ID_KEY=(str, ''), # Key associated with OIDC user IDs
30+
DD_SOCIAL_AUTH_OIDC_USERNAME_KEY=(str, ''), # Key associated with OIDC usernames
31+
DD_SOCIAL_AUTH_CREATE_USER_MAPPING=(str, 'username'), # Can also be 'email' or 'fullname'
32+
DD_SOCIAL_AUTH_OIDC_WHITELISTED_DOMAINS=(list, ['']), # Domains allowed for login
33+
DD_SOCIAL_AUTH_OIDC_JWT_ALGORITHMS=(list, ['RS256', 'HS256']),
34+
DD_SOCIAL_AUTH_OIDC_ID_TOKEN_ISSUER=(str, ''),
35+
DD_SOCIAL_AUTH_OIDC_ACCESS_TOKEN_URL=(str, ''),
36+
DD_SOCIAL_AUTH_OIDC_AUTHORIZATION_URL=(str, ''),
37+
DD_SOCIAL_AUTH_OIDC_USERINFO_URL=(str, ''),
38+
DD_SOCIAL_AUTH_OIDC_JWKS_URI=(str, ''),
39+
DD_SOCIAL_AUTH_OIDC_LOGIN_BUTTON_TEXT=(str, 'Login with OIDC'),
40+
{{< /highlight >}}

0 commit comments

Comments
 (0)