[ARVADOS] updated: 1.1.2-114-g95c228e

Git user git at public.curoverse.com
Mon Jan 22 16:03:18 EST 2018


Summary of changes:
 .../app/assets/javascripts/models/session_db.js        | 18 ++++++++++++++----
 apps/workbench/app/views/search/index.html.erb         |  7 +++++++
 2 files changed, 21 insertions(+), 4 deletions(-)
 create mode 100644 apps/workbench/app/views/search/index.html.erb

       via  95c228e25cd1a483ec391a9b2c5d6fb048f620f1 (commit)
      from  4dda3a5b85afbac450d958d81e2acb013c5bae20 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 95c228e25cd1a483ec391a9b2c5d6fb048f620f1
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Mon Jan 22 18:00:25 2018 -0300

    11454: Conditional login to remote API servers.
    
    When adding new sites to the multi site search, if the remote
    site allows federated logins from the local site, created a
    salted token to be able to start a session.
    If not, use the classic login method.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/apps/workbench/app/assets/javascripts/models/session_db.js b/apps/workbench/app/assets/javascripts/models/session_db.js
index 28c5cc4..79e98ca 100644
--- a/apps/workbench/app/assets/javascripts/models/session_db.js
+++ b/apps/workbench/app/assets/javascripts/models/session_db.js
@@ -82,9 +82,20 @@ window.SessionDB = function(rhosts) {
             // also call checkForNewToken() on (at least) its first
             // render. Otherwise, the login procedure can't be
             // completed.
-            var remoteAPI = new URL(baseURL)
-            db.saltedToken(remoteAPI.hostname.split('.')[0]).then(function(token) {
-                document.location = baseURL + 'login?return_to=' + encodeURIComponent(document.location.href.replace(/\?.*/, '')+'?baseURL='+encodeURIComponent(baseURL)) + '&api_token='+encodeURIComponent(token)
+            var session = db.loadLocal()
+            var uuidPrefix = session.user.owner_uuid.slice(0, 5)
+            var apiHostname = new URL(session.baseURL).hostname
+            m.request(baseURL+'discovery/v1/apis/arvados/v1/rest').then(function(dd) {
+                if (uuidPrefix in dd.remoteHosts ||
+                    (dd.remoteHostsViaDNS && apiHostname.indexOf('arvadosapi.com') >= 0)) {
+                    // Federated identity login via salted token
+                    db.saltedToken(dd.uuidPrefix).then(function(token) {
+                        document.location = baseURL + 'login?return_to=' + encodeURIComponent(document.location.href.replace(/\?.*/, '')+'?baseURL='+encodeURIComponent(baseURL)) + '&api_token='+encodeURIComponent(token)
+                    })
+                } else {
+                    // Classic login
+                    document.location = baseURL + 'login?return_to=' + encodeURIComponent(document.location.href.replace(/\?.*/, '')+'?baseURL='+encodeURIComponent(baseURL))
+                }
             })
             return false
         },
@@ -100,7 +111,6 @@ window.SessionDB = function(rhosts) {
             // Takes a cluster UUID prefix and returns a salted token to allow
             // log into said cluster using federated identity.
             var session = db.loadLocal()
-            var st = m.stream()
             return db.request(session, '/arvados/v1/api_client_authorizations', {
                 data: {
                     filters: JSON.stringify([['api_token', '=', session.token]]),
diff --git a/apps/workbench/app/views/search/index.html.erb b/apps/workbench/app/views/search/index.html.erb
new file mode 100644
index 0000000..ff3e190
--- /dev/null
+++ b/apps/workbench/app/views/search/index.html.erb
@@ -0,0 +1,7 @@
+<!-- Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: AGPL-3.0 -->
+
+<div data-mount-mithril="Search" 
+    data-remote-hosts="<%= Rails.configuration.remote_hosts %>">
+</div>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list