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

SAML SSO #1023

Merged
merged 3 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions scripts/mkaliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ echo "alias tso=tethys_server_own" >> "${ACTIVATE_SCRIPT}"
echo "alias cs='tuo; tethys manage collectstatic; tso;'" >> "${ACTIVATE_SCRIPT}"
echo "alias tsr='tso; sudo systemctl restart supervisord'" >> "${ACTIVATE_SCRIPT}"
# Add lines that remove the aliases to the deactivate Script
echo "unset TETHYS_HOME" > "${DEACTIVATE_SCRIPT}"
echo "unalias vipc" > "${DEACTIVATE_SCRIPT}"
echo "unalias tethys_user_own" > "${DEACTIVATE_SCRIPT}"
echo "unalias tuo" >> "${DEACTIVATE_SCRIPT}"
Expand Down
3 changes: 3 additions & 0 deletions tethys_portal/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
"""

from .optional_dependencies import has_module
from django.conf import settings


def tethys_portal_context(request):
idps = settings.SOCIAL_AUTH_SAML_ENABLED_IDPS if hasattr(settings, 'SOCIAL_AUTH_SAML_ENABLED_IDPS') else {}
context = {
"has_analytical": has_module("analytical"),
"has_recaptcha": has_module("snowpenguin.django.recaptcha2"),
Expand All @@ -20,6 +22,7 @@ def tethys_portal_context(request):
"has_gravatar": has_module("django_gravatar"),
"has_session_security": has_module("session_security"),
"has_oauth2_provider": has_module("oauth2_provider"),
"idp_backends": idps.keys(),
}

return context
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
<a class="btn btn-block btn-social btn-onelogin" href="{% url 'social:begin' backend %}{% if request.GET.next %}?next={{request.GET.next|urlencode}}{% endif %}">
<i class="bi bi-onelogin"></i> {{ action }} with OneLogin
</a>
{% elif 'saml' in backend %}
{% for idp in idp_backends %}
<a class="btn btn-block btn-social btn-saml" href="{% url 'social:begin' backend %}?idp={{ idp }}{% if request.GET.next %}&next={{request.GET.next|urlencode}}{% endif %}">
<i class="bi bi-box-arrow-in-left"></i> {{ action }} through {{ idp }} with SAML
</a>
{% endfor %}
{% else %}
<a class="btn btn-block btn-social btn-custom-oauth" href="{% url 'social:begin' backend %}{% if request.GET.next %}?next={{request.GET.next|urlencode}}{% endif %}">
<i class="bi bi-unlock-fill"></i> {{ action }} with {{ backend }}
Expand Down
Loading