You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2020/02/18 01:28:24 UTC
[zeppelin] branch branch-0.8 updated: [ZEPPELIN-4580] check the
instance type rather than the class name
This is an automated email from the ASF dual-hosted git repository.
zjffdu pushed a commit to branch branch-0.8
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/branch-0.8 by this push:
new 7e4efb7 [ZEPPELIN-4580] check the instance type rather than the class name
7e4efb7 is described below
commit 7e4efb7652c56c0efc1eb6fc3738cd86ab7e6f12
Author: Jeff Hammel <je...@leapyear.io>
AuthorDate: Tue Feb 11 09:36:33 2020 -0800
[ZEPPELIN-4580] check the instance type rather than the class name
### What is this PR for?
A few sentences describing the overall goals of the pull request's commits.
First time? Check out the contributing guide - https://zeppelin.apache.org/contribution/contributions.html
This checks if the realm is an instance of KnoxJwtRealm instead of checking for it by name to enable subclassing of KnoxJwtRealm.
### What type of PR is it?
[Bug Fix]
### Todos
* [ ] - Task
### What is the Jira issue?
* Open an issue on Jira https://issues.apache.org/jira/browse/ZEPPELIN/
* Put link here, and add [ZEPPELIN-*Jira number*] in PR title, eg. [ZEPPELIN-533]
https://issues.apache.org/jira/browse/ZEPPELIN-4580
### How should this be tested?
* First time? Setup Travis CI as described on https://zeppelin.apache.org/contribution/contributions.html#continuous-integration
* Strongly recommended: add automated unit tests for any new or changed behavior
* Outline any manual steps to test the PR here.
I have tested this change manually with a custom authenticator in an integrated environment. JWT authentication works.
I have also set up Travis. A run is at https://travis-ci.org/LeapYear/zeppelin-source/builds/649031975 but there seem to be several errors unrelated to this change.
### 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: Jeff Hammel <je...@leapyear.io>
Closes #3618 from jeff-hammel-leapyear/jeff/knox_instanceof and squashes the following commits:
3909846f8 [Jeff Hammel] remove now unused references to name
00c3d7dae [Jeff Hammel] check the instance type rather than the class name
---
.../src/main/java/org/apache/zeppelin/rest/LoginRestApi.java | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
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 8d96188..dbb15f3 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
@@ -105,11 +105,7 @@ public class LoginRestApi {
if (realmsList != null) {
for (Iterator<Realm> iterator = realmsList.iterator(); iterator.hasNext(); ) {
Realm realm = iterator.next();
- String name = realm.getClass().getName();
-
- LOG.debug("RealmClass.getName: " + name);
-
- if (name.equals("org.apache.zeppelin.realm.jwt.KnoxJwtRealm")) {
+ if (realm instanceof KnoxJwtRealm) {
return (KnoxJwtRealm) realm;
}
}
@@ -122,9 +118,7 @@ public class LoginRestApi {
if (realmsList != null) {
for (Iterator<Realm> iterator = realmsList.iterator(); iterator.hasNext(); ) {
Realm realm = iterator.next();
- String name = realm.getClass().getName();
- LOG.debug("RealmClass.getName: " + name);
- if (name.equals("org.apache.zeppelin.realm.jwt.KnoxJwtRealm")) {
+ if (realm instanceof KnoxJwtRealm) {
return true;
}
}