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 2017/05/02 04:22:45 UTC
zeppelin git commit: [hotfix] Improve Session #2302 fix
Repository: zeppelin
Updated Branches:
refs/heads/master 55cb6b894 -> 6c4ccf331
[hotfix] Improve Session #2302 fix
### What is this PR for?
After the merge of #2302 breaks authentication.
### What type of PR is it?
[Hot Fix]
### Todos
* [x] - Fix selenium logout issue (flaky test)
### Questions:
* Does the licenses files need update?
* Is there breaking changes for older versions?
* Does this needs documentation?
Author: Prabhjyot Singh <pr...@gmail.com>
Closes #2304 from prabhjyotsingh/hotfix/ImproveSession and squashes the following commits:
94ba9e774 [Prabhjyot Singh] check if modal window is present, and then close it
f993b59fa [Prabhjyot Singh] improve session
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/6c4ccf33
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/6c4ccf33
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/6c4ccf33
Branch: refs/heads/master
Commit: 6c4ccf331e7e5aa3f17cef40d340c29930887413
Parents: 55cb6b8
Author: Prabhjyot Singh <pr...@gmail.com>
Authored: Mon May 1 02:11:47 2017 +0530
Committer: Prabhjyot Singh <pr...@gmail.com>
Committed: Tue May 2 09:52:40 2017 +0530
----------------------------------------------------------------------
.../main/java/org/apache/zeppelin/rest/LoginRestApi.java | 3 ++-
.../apache/zeppelin/integration/AuthenticationIT.java | 11 +++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6c4ccf33/zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java
index c9b24b1..e909541 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java
@@ -74,9 +74,10 @@ public class LoginRestApi {
try {
UsernamePasswordToken token = new UsernamePasswordToken(userName, password);
// token.setRememberMe(true);
- currentUser.login(token);
+
currentUser.getSession().stop();
currentUser.getSession(true);
+ currentUser.login(token);
HashSet<String> roles = SecurityUtils.getRoles();
String principal = SecurityUtils.getPrincipal();
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6c4ccf33/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java
index 24e3480..9abbe28 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.List;
import org.apache.commons.io.FileUtils;
@@ -146,14 +147,20 @@ public class AuthenticationIT extends AbstractZeppelinIT {
}
}
- private void logoutUser(String userName) {
+ private void logoutUser(String userName) throws URISyntaxException {
ZeppelinITUtils.sleep(500, false);
driver.findElement(By.xpath("//div[contains(@class, 'navbar-collapse')]//li[contains(.,'" +
userName + "')]")).click();
ZeppelinITUtils.sleep(500, false);
driver.findElement(By.xpath("//div[contains(@class, 'navbar-collapse')]//li[contains(.,'" +
userName + "')]//a[@ng-click='navbar.logout()']")).click();
- ZeppelinITUtils.sleep(5000, false);
+ ZeppelinITUtils.sleep(2000, false);
+ if (driver.findElement(By.xpath("//*[@id='loginModal']//div[contains(@class, 'modal-header')]/button"))
+ .isDisplayed()) {
+ driver.findElement(By.xpath("//*[@id='loginModal']//div[contains(@class, 'modal-header')]/button")).click();
+ }
+ driver.get(new URI(driver.getCurrentUrl()).resolve("/#/").toString());
+ ZeppelinITUtils.sleep(500, false);
}
// @Test