Skip to content

[ZEPPELIN-1125] Application does not logout user when authcBasic and ./grunt serve is used#1140

Closed
prabhjyotsingh wants to merge 2 commits intoapache:masterfrom
prabhjyotsingh:ZEPPELIN-1125
Closed

[ZEPPELIN-1125] Application does not logout user when authcBasic and ./grunt serve is used#1140
prabhjyotsingh wants to merge 2 commits intoapache:masterfrom
prabhjyotsingh:ZEPPELIN-1125

Conversation

@prabhjyotsingh
Copy link
Contributor

What is this PR for?

Creating this issue from this comment, Application does not logout user when authcBasic is used and process was running with grunt serve

What type of PR is it?

[Bug Fix]

What is the Jira issue?

How should this be tested?

Run web-app as grunt serve and configure shiro auth to use authcBasic, and then try to logout.

Screenshots (if appropriate)

Questions:

  • Does the licenses files need update? no
  • Is there breaking changes for older versions? no
  • Does this needs documentation? no

@prabhjyotsingh
Copy link
Contributor Author

@corneadoug, have made a fix for #1071 (comment). Can you please review.

@corneadoug
Copy link
Contributor

@prabhjyotsingh Thanks, I will test that

@r-kamath
Copy link
Member

r-kamath commented Jul 7, 2016

LGTM

}

@POST
@GET
Copy link
Contributor

@anthonycorbacho anthonycorbacho Jul 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to change logout from POST to GET? I dont think its aligned with HTTP standard.

@prabhjyotsingh prabhjyotsingh changed the title Application does not logout user when authcBasic and ./grunt serve is used [ZEPPELIN-1125] Application does not logout user when authcBasic and ./grunt serve is used Jul 8, 2016
@corneadoug
Copy link
Contributor

@prabhjyotsingh I got it fixed by only replacing the logout function in the front-end with:

$http.post(logoutURL)
    .error(function(response) {
      console.log('logout error %o', response);
    })
    .success(function(response) {
      $rootScope.userName = response.body.principal;
      $rootScope.ticket.principal = response.body.principal;
      $rootScope.ticket.ticket = response.body.ticket;
      $rootScope.ticket.roles = response.body.role;
      BootstrapDialog.show({
        message: 'Logout Success'
      });
      setTimeout(function() {
        window.location.replace('/');
      }, 1000);
    });

This could probably use some ngToast when error

@prabhjyotsingh
Copy link
Contributor Author

prabhjyotsingh commented Jul 8, 2016

@corneadoug I tried your approach, it didn't worked for me, rest other review comments are implemented.

@corneadoug
Copy link
Contributor

@prabhjyotsingh Let me try again

@corneadoug
Copy link
Contributor

corneadoug commented Jul 8, 2016

@prabhjyotsingh You are calling $http.post twice instead of once.
Also, could you reverse the response message UNAUTHORIZED to OK, so that we can keep a success catch event when logout succeed?

I tried both Chrome and Firefox

@prabhjyotsingh
Copy link
Contributor Author

Yes, basic-auth was not getting logout on first call, hence I had to call it twice.
Advantage of keeping UNAUTHORIZED is that we don't have to bother about $http.post's success, since just after that we are redirecting page to "/" where all the init variables will be re-set.

@prabhjyotsingh
Copy link
Contributor Author

@corneadoug Shall I merge this, if it works for you ?

@corneadoug
Copy link
Contributor

@prabhjyotsingh Basic Auth is getting logout after only one call.

Advantage of keeping UNAUTHORIZED is that we don't have to bother about $http.post's success, since just after that we are redirecting page to "/" where all the init variables will be re-set.

I don't see your point, you still have to handle an action after getting the message from the API, whether it is UNAUTHORIZED or OK.

If the API action is successful, it should be OK.

@prabhjyotsingh
Copy link
Contributor Author

prabhjyotsingh commented Jul 10, 2016

Basic Auth is getting logout after only one call.

Kind of strange it, doesn't work for me. Have attached gif's where in console, first I'm trying to call it once, then twice, and on calling it twice, it logout.

chrome-gif

firefox-gif

Also after making API return OK instead of UNAUTHORIZED, ./grunt serve stops working, guess this would be this reason.
http://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication/233551#233551

@corneadoug corneadoug mentioned this pull request Jul 11, 2016
@corneadoug
Copy link
Contributor

@prabhjyotsingh I made a test PR with gif of Chrome, Firefox, Safari #1159

@prabhjyotsingh
Copy link
Contributor Author

@corneadoug should we merge this, so that, grunt serve starts working, and tune this later ?

@corneadoug
Copy link
Contributor

@prabhjyotsingh LGTM

@asfgit asfgit closed this in 89b71ca Jul 18, 2016
asfgit pushed a commit that referenced this pull request Jul 19, 2016
…`./grunt serve` is used

### What is this PR for?
Creating this issue from [this](#1071 (comment)) comment, Application does not logout user when authcBasic is used and process was running with `grunt serve`

### What type of PR is it?
[Bug Fix]

### What is the Jira issue?
* [ZEPPELIN-1125](https://issues.apache.org/jira/browse/ZEPPELIN-1125)

### How should this be tested?
Run web-app as `grunt serve` and configure shiro auth to use `authcBasic`, and then try to logout.

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Prabhjyot Singh <prabhjyotsingh@gmail.com>

Closes #1140 from prabhjyotsingh/ZEPPELIN-1125 and squashes the following commits:

04a2aff [Prabhjyot Singh] remove unrequired params from response, revert to post
986d549 [Prabhjyot Singh] Application does not logout user when authcBasic and running on a different host/port

(cherry picked from commit 89b71ca)
Signed-off-by: Mina Lee <minalee@apache.org>
PhilippGrulich pushed a commit to SWC-SENSE/zeppelin that referenced this pull request Aug 8, 2016
…`./grunt serve` is used

### What is this PR for?
Creating this issue from [this](apache#1071 (comment)) comment, Application does not logout user when authcBasic is used and process was running with `grunt serve`

### What type of PR is it?
[Bug Fix]

### What is the Jira issue?
* [ZEPPELIN-1125](https://issues.apache.org/jira/browse/ZEPPELIN-1125)

### How should this be tested?
Run web-app as `grunt serve` and configure shiro auth to use `authcBasic`, and then try to logout.

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Prabhjyot Singh <prabhjyotsingh@gmail.com>

Closes apache#1140 from prabhjyotsingh/ZEPPELIN-1125 and squashes the following commits:

04a2aff [Prabhjyot Singh] remove unrequired params from response, revert to post
986d549 [Prabhjyot Singh] Application does not logout user when authcBasic and running on a different host/port
@prabhjyotsingh prabhjyotsingh deleted the ZEPPELIN-1125 branch February 25, 2018 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants