You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/11/04 22:05:00 UTC

[airavata-django-portal] branch master updated: AIRAVATA-3256 Fix desktop client login through external idp

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/master by this push:
     new fa8b406  AIRAVATA-3256 Fix desktop client login through external idp
fa8b406 is described below

commit fa8b406400c3d0959d06cd3fe89ddd713737aa25
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Nov 4 17:04:38 2019 -0500

    AIRAVATA-3256 Fix desktop client login through external idp
---
 .../templates/django_airavata_auth/partials/externals_login_form.html  | 2 ++
 django_airavata/apps/auth/views.py                                     | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/django_airavata/apps/auth/templates/django_airavata_auth/partials/externals_login_form.html b/django_airavata/apps/auth/templates/django_airavata_auth/partials/externals_login_form.html
index 0548481..cfbed8a 100644
--- a/django_airavata/apps/auth/templates/django_airavata_auth/partials/externals_login_form.html
+++ b/django_airavata/apps/auth/templates/django_airavata_auth/partials/externals_login_form.html
@@ -9,6 +9,8 @@
                 <a
                 {% if next %}
                     href="{% url 'django_airavata_auth:redirect_login' external.idp_alias %}?next={{ next | urlencode }}"
+                {% elif login_desktop %}
+                    href="{% url 'django_airavata_auth:redirect_login' external.idp_alias %}?login_desktop=true"
                 {% else %}
                     href="{% url 'django_airavata_auth:redirect_login' external.idp_alias %}"
                 {% endif %}
diff --git a/django_airavata/apps/auth/views.py b/django_airavata/apps/auth/views.py
index 2fee97c..8b82e11 100644
--- a/django_airavata/apps/auth/views.py
+++ b/django_airavata/apps/auth/views.py
@@ -49,6 +49,8 @@ def redirect_login(request, idp_alias):
     redirect_uri += '?idp_alias=' + quote(idp_alias)
     if 'next' in request.GET:
         redirect_uri += "&next=" + quote(request.GET['next'])
+    if 'login_desktop' in request.GET:
+        redirect_uri += "&login_desktop=" + quote(request.GET['login_desktop'])
     oauth2_session = OAuth2Session(
         client_id, scope='openid', redirect_uri=redirect_uri)
     authorization_url, state = oauth2_session.authorization_url(
@@ -114,6 +116,7 @@ def callback(request):
     try:
         user = authenticate(request=request)
         login(request, user)
+        login_desktop = request.GET.get('login_desktop', "false") == "true"
         if login_desktop:
             return _create_login_desktop_success_response(request)
         next_url = request.GET.get('next', settings.LOGIN_REDIRECT_URL)