Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(saml): configurable login button text #5449

Merged
merged 1 commit into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/content/en/integrations/social-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ homepage](https://github.com/IdentityPython/djangosaml2).

{{< highlight python >}}
DD_SAML2_ENABLED=(bool, **True**),
# SAML Login Button Text
DD_SAML2_LOGIN_BUTTON_TEXT=(str, 'Login with SAML'),
# If the metadata can be accessed from a url, try the
DD_SAML2_METADATA_AUTO_CONF_URL=(str, '<https://your_IdP.com/metadata.xml>'),
# Otherwise, downlaod a copy of the metadata into an xml file, and
Expand All @@ -263,8 +265,7 @@ NOTE: *DD_SAML2_ATTRIBUTES_MAP* in k8s can be referenced as extraConfig (e.g. `D
4. Checkout the SAML section in dojo/`dojo/settings/settings.dist.py` and verfiy if it fits your requirement. If you need help, take a look at the [plugin
documentation](https://djangosaml2.readthedocs.io/contents/setup.html#configuration).

5. Restart DefectDojo, and you should now see a **Login with SAML**
button on the login page.
5. Restart DefectDojo, and you should now see a **Login with SAML** button (default setting of DD_SAML2_LOGIN_BUTTON_TEXT) on the login page.

NOTE: In the case when IDP is configured to use self signed (private) certificate,
than CA needs to be specified by define environments variable
Expand Down
1 change: 1 addition & 0 deletions dojo/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def globalize_oauth_vars(request):
'GITLAB_ENABLED': settings.GITLAB_OAUTH2_ENABLED,
'AZUREAD_TENANT_OAUTH2_ENABLED': settings.AZUREAD_TENANT_OAUTH2_ENABLED,
'SAML2_ENABLED': settings.SAML2_ENABLED,
'SAML2_LOGIN_BUTTON_TEXT': settings.SAML2_LOGIN_BUTTON_TEXT,
'SAML2_LOGOUT_URL': settings.SAML2_LOGOUT_URL}


Expand Down
2 changes: 2 additions & 0 deletions dojo/settings/settings.dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
DD_SOCIAL_AUTH_GITLAB_API_URL=(str, 'https://gitlab.com'),
DD_SOCIAL_AUTH_GITLAB_SCOPE=(list, ['api', 'read_user', 'openid', 'profile', 'email']),
DD_SAML2_ENABLED=(bool, False),
DD_SAML2_LOGIN_BUTTON_TEXT=(str, 'Login with SAML'),
# Optional: display the idp SAML Logout URL in DefectDojo
DD_SAML2_LOGOUT_URL=(str, ''),
# Metadata is required for SAML, choose either remote url or local file path
Expand Down Expand Up @@ -759,6 +760,7 @@ def saml2_attrib_map_format(dict):


SAML2_ENABLED = env('DD_SAML2_ENABLED')
SAML2_LOGIN_BUTTON_TEXT = env('DD_SAML2_LOGIN_BUTTON_TEXT')
SAML2_LOGOUT_URL = env('DD_SAML2_LOGOUT_URL')
if SAML2_ENABLED:
import saml2
Expand Down
2 changes: 1 addition & 1 deletion dojo/templates/dojo/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h3>Login</h3>
{% if SAML2_ENABLED is True %}
<div class="col-sm-offset-1 col-sm-2">
<button class="btn btn-success" type="button">
<a id="oauth-login-saml" rel="nofollow" data-method="post" href="/saml2/login" style="color: rgb(255,255,255)">Login with SAML</a>
<a id="oauth-login-saml" rel="nofollow" data-method="post" href="/saml2/login" style="color: rgb(255,255,255)">{{ SAML2_LOGIN_BUTTON_TEXT }}</a>
</button>
</div>
{% endif %}
Expand Down