Repository: ambari Updated Branches: refs/heads/branch-2.1 11a064ed5 -> 401e8f3df
Revert "AMBARI-12153. Ambari Web should automatically log the user in if valid HTTP authorization header is present (Single Sign On). (yusaku)" This reverts commit 0d5cb02de893bf27f1ada92e21f15b06131c759f. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/401e8f3d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/401e8f3d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/401e8f3d Branch: refs/heads/branch-2.1 Commit: 401e8f3df1e31a487107e604f9828d1af92f1121 Parents: 11a064e Author: Jaimin Jetly <[email protected]> Authored: Sat Jun 27 13:24:09 2015 -0700 Committer: Jaimin Jetly <[email protected]> Committed: Sat Jun 27 13:33:10 2015 -0700 ---------------------------------------------------------------------- ambari-web/app/router.js | 53 +++++++++++++------------------------------ 1 file changed, 16 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/401e8f3d/ambari-web/app/router.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js index 38dae93..9ea8f54 100644 --- a/ambari-web/app/router.js +++ b/ambari-web/app/router.js @@ -132,48 +132,27 @@ App.Router = Em.Router.extend({ var dfd = $.Deferred(); var self = this; var auth = App.db.getAuthenticated(); - App.ajax.send({ - name: 'router.login.clusters', - sender: this, - success: 'onAuthenticationSuccess', - error: 'onAuthenticationError' - }).complete(function (xhr) { - if (xhr.isResolved()) { - // if server knows the user and user authenticated by UI - if (auth && auth === true) { + var authResp = (auth && auth === true); + if (authResp) { + App.ajax.send({ + name: 'router.login.clusters', + sender: this, + success: 'onAuthenticationSuccess', + error: 'onAuthenticationError' + }).complete(function () { dfd.resolve(self.get('loggedIn')); - // if server knows the user but UI don't, check the response header - // and try to authorize - } else if (xhr.getResponseHeader('User')) { - var user = xhr.getResponseHeader('User'); - App.ajax.send({ - name: 'router.login', - sender: self, - data: { - usr: user, - loginName: encodeURIComponent(user) - }, - success: 'loginSuccessCallback', - error: 'loginErrorCallback' - }); - } else { - self.setAuthenticated(false); - dfd.resolve(false); - } - } else { - self.setAuthenticated(false); - dfd.resolve(false); - } - }); + }); + } else { + this.set('loggedIn', false); + dfd.resolve(false); + } return dfd.promise(); }, onAuthenticationSuccess: function (data) { - if (App.db.getAuthenticated() === true) { - this.setAuthenticated(true); - if (data.items.length) { - this.setClusterInstalled(data); - } + this.setAuthenticated(true); + if (data.items.length) { + this.setClusterInstalled(data); } },
