You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by pr...@apache.org on 2016/06/24 07:23:35 UTC
zeppelin git commit: [ZEPPELIN-1052] Application does not logout user
when authcBasic is used
Repository: zeppelin
Updated Branches:
refs/heads/master 6497008cc -> 8154c8721
[ZEPPELIN-1052] Application does not logout user when authcBasic is used
### What is this PR for?
This PR is WRT to [this](http://apache-zeppelin-users-incubating-mailing-list.75479.x6.nabble.com/Fwd-Authentication-in-zeppelin-td3354.html) mail thread (Authentication in zeppelin)
Where in if authcBasic mechanisim is used then on clicking logout, the user doesn't gets logout.
### What type of PR is it?
[Bug Fix]
### Todos
* [x] - set username and password false on logout
### What is the Jira issue?
* [ZEPPELIN-533](https://issues.apache.org/jira/browse/ZEPPELIN-1052)
### How should this be tested?
In shiro.ini conf set `/** = authcBasic`, then start the zeppelin server.
- try login as admin/password1
- now try to logout (this should work)
### Questions:
* Does the licenses files need update? n/a
* Is there breaking changes for older versions? n/a
* Does this needs documentation? n/a
Author: Prabhjyot Singh <pr...@gmail.com>
Closes #1071 from prabhjyotsingh/ZEPPELIN-1052 and squashes the following commits:
6f4dd09 [Prabhjyot Singh] force authcBasic by setting credentials as false:false
b3d6935 [Prabhjyot Singh] set username and password false on logout
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/8154c872
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/8154c872
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/8154c872
Branch: refs/heads/master
Commit: 8154c87219262248532fe15ea97cc84817f7b862
Parents: 6497008
Author: Prabhjyot Singh <pr...@gmail.com>
Authored: Thu Jun 23 19:06:31 2016 +0530
Committer: Prabhjyot Singh <pr...@gmail.com>
Committed: Fri Jun 24 12:53:18 2016 +0530
----------------------------------------------------------------------
.../src/components/navbar/navbar.controller.js | 44 ++++++++++++--------
1 file changed, 26 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/8154c872/zeppelin-web/src/components/navbar/navbar.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/navbar/navbar.controller.js b/zeppelin-web/src/components/navbar/navbar.controller.js
index cb1d91c..31e595e 100644
--- a/zeppelin-web/src/components/navbar/navbar.controller.js
+++ b/zeppelin-web/src/components/navbar/navbar.controller.js
@@ -30,7 +30,7 @@ angular.module('zeppelinWebApp')
return notebook;
}
- if (notebook.children) {
+ if (notebook.children) {
filteringNote(notebook.children, filteredNotes);
}
});
@@ -85,23 +85,31 @@ angular.module('zeppelinWebApp')
});
$scope.logout = function() {
- $http.post(baseUrlSrv.getRestApiBase()+'/login/logout')
- .success(function(data, status, headers, config) {
- $rootScope.userName = '';
- $rootScope.ticket.principal = '';
- $rootScope.ticket.ticket = '';
- $rootScope.ticket.roles = '';
- BootstrapDialog.show({
- message: 'Logout Success'
- });
- setTimeout(function() {
- window.location = '#';
- window.location.reload();
- }, 1000);
- }).
- error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- });
+ var logoutURL = baseUrlSrv.getRestApiBase() + '/login/logout';
+ var request = new XMLHttpRequest();
+
+ //force authcBasic (if configured) to logout by setting credentials as false:false
+ request.open('post', logoutURL, true, 'false', 'false');
+ request.onreadystatechange = function() {
+ if (request.readyState === 4) {
+ if (request.status === 401 || request.status === 405) {
+ $rootScope.userName = '';
+ $rootScope.ticket.principal = '';
+ $rootScope.ticket.ticket = '';
+ $rootScope.ticket.roles = '';
+ BootstrapDialog.show({
+ message: 'Logout Success'
+ });
+ setTimeout(function() {
+ window.location.replace('/');
+ }, 1000);
+ } else {
+ request.open('post', logoutURL, true, 'false', 'false');
+ request.send();
+ }
+ }
+ };
+ request.send();
};
$scope.search = function(searchTerm) {