Repository: zeppelin
Updated Branches:
  refs/heads/master 1ff8c1475 -> 33eb08be7


[ZEPPELIN-2731] GetUserList with JDBCRealm should read field authenti…

…cationQuery

### What is this PR for?
GetUserList with JDBCRealm should read field authenticationQuery but not 
DEFAULT_AUTHENTICATION_QUERY,
or it will assume that the query must be "select password from users where 
username = ?"

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

### Todos
None

### What is the Jira issue?
* https://issues.apache.org/jira/projects/ZEPPELIN/issues/ZEPPELIN-2731

### How should this be tested?
1. In shiro.ini config the JDBCRealm like:

ds = org.apache.commons.dbcp2.BasicDataSource
ds.driverClassName = com.mysql.jdbc.Driver
ds.url= jdbc:mysql://localhost:3306/shiro
ds.username = root
ds.password = 123456

jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
jdbcRealm.dataSource = $ds
jdbcRealm.permissionsLookupEnabled = false
jdbcRealm.authenticationQuery = SELECT password FROM user WHERE name = ?
jdbcRealm.userRolesQuery = SELECT role_name FROM user_roles WHERE name  = ?
jdbcRealm.permissionsQuery = SELECT permission FROM roles_permissions WHERE 
role_name = ?

2. login and request the rest
Get /security/userlist/youruser

### 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: lichenyang <licheny...@cmss.chinamobile.com>

Closes #2466 from reminia/zeppelin-2731 and squashes the following commits:

84b3fde [lichenyang] [ZEPPELIN-2731] GetUserList with JDBCRealm should read 
field authenticationQuery


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/33eb08be
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/33eb08be
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/33eb08be

Branch: refs/heads/master
Commit: 33eb08be765b08ced3b750290c9d7cd155ef60ff
Parents: 1ff8c14
Author: lichenyang <licheny...@cmss.chinamobile.com>
Authored: Thu Jul 6 12:36:55 2017 +0800
Committer: Lee moon soo <m...@apache.org>
Committed: Mon Jul 10 13:00:48 2017 +0900

----------------------------------------------------------------------
 .../src/main/java/org/apache/zeppelin/rest/GetUserList.java        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/33eb08be/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java 
b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
index f0e3740..c0270dd 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/GetUserList.java
@@ -212,7 +212,7 @@ public class GetUserList {
     String userquery = "";
     try {
       dataSource = (DataSource) FieldUtils.readField(obj, "dataSource", true);
-      authQuery = (String) FieldUtils.readField(obj, 
"DEFAULT_AUTHENTICATION_QUERY", true);
+      authQuery = (String) FieldUtils.readField(obj, "authenticationQuery", 
true);
       LOG.info(authQuery);
       String authQueryLowerCase = authQuery.toLowerCase();
       retval = authQueryLowerCase.split("from", 2);

Reply via email to