X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fframework%2Futils%2Futils.js;h=16037d7407f5751b8a2bdf7f38e1ae009d0eed00;hb=3f7d3075ddc01e1f26ecf4fa472189d67a8d9c50;hp=e8e9ad1a95360799c13325c10460a37cf6637737;hpb=625a4c2118c4d095daf2a264643798eddf4d0491;p=osm%2FUI.git diff --git a/skyquake/framework/utils/utils.js b/skyquake/framework/utils/utils.js index e8e9ad1a9..16037d740 100644 --- a/skyquake/framework/utils/utils.js +++ b/skyquake/framework/utils/utils.js @@ -26,6 +26,7 @@ var SockJS = require('sockjs-client'); var Utils = {}; Utils.DescriptorModelMeta = null; +// Utils.DescriptorModelMeta = require('./../../plugins/composer/src/src/libraries/model/DescriptorModelMeta.json'); var INACTIVITY_TIMEOUT = 600000; @@ -129,8 +130,9 @@ Utils.getDescriptorModelMeta = function() { } Utils.addAuthorizationStub = function(xhr) { - var Auth = window.sessionStorage.getItem("auth"); - xhr.setRequestHeader('Authorization', 'Basic ' + Auth); + // NO-OP now that we are dealing with it on the server + // var Auth = window.sessionStorage.getItem("auth"); + // xhr.setRequestHeader('Authorization', 'Basic ' + Auth); }; Utils.getByteDataWithUnitPrefix = function(number, precision) { @@ -208,10 +210,22 @@ Utils.clearAuthentication = function(callback) { window.sessionStorage.removeItem("auth"); AuthActions.notAuthenticated(); window.sessionStorage.setItem("locationRefHash", window.location.hash); + $.ajax({ + url: '//' + window.location.hostname + ':' + window.location.port + '/session?api_server=' + API_SERVER, + type: 'DELETE', + success: function(data) { + console.log('User logged out'); + }, + error: function(data) { + console.log('Problem logging user out'); + } + }); + + if (callback) { callback(); } else { - window.location.hash = Utils.loginHash; + window.location.replace(window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + '/?api_server=' + API_SERVER); } } Utils.isNotAuthenticated = function(windowLocation, callback) {