You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by sp...@apache.org on 2021/11/22 22:32:28 UTC
[ranger] branch master updated: RANGER-3515: Enhance Ranger Java client SSL config to be configured using serviceType and AppId
This is an automated email from the ASF dual-hosted git repository.
spolavarapu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push:
new b56aa63 RANGER-3515: Enhance Ranger Java client SSL config to be configured using serviceType and AppId
b56aa63 is described below
commit b56aa63a9e1b2020e208c170642a96f5d62cd892
Author: Abhishek Kumar <ab...@gmail.com>
AuthorDate: Sun Nov 21 14:28:31 2021 -0800
RANGER-3515: Enhance Ranger Java client SSL config to be configured using serviceType and AppId
Signed-off-by: Sailaja Polavarapu <sp...@cloudera.com>
---
intg/src/main/java/org/apache/ranger/RangerClient.java | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/intg/src/main/java/org/apache/ranger/RangerClient.java b/intg/src/main/java/org/apache/ranger/RangerClient.java
index a1e1c7a..add084f 100644
--- a/intg/src/main/java/org/apache/ranger/RangerClient.java
+++ b/intg/src/main/java/org/apache/ranger/RangerClient.java
@@ -19,6 +19,7 @@
package org.apache.ranger;
import com.sun.jersey.api.client.GenericType;
+import org.apache.ranger.authorization.hadoop.config.RangerPluginConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.jersey.api.client.ClientResponse;
@@ -142,9 +143,7 @@ public class RangerClient {
private boolean isSecureMode = false;
private Subject sub = null;
- public RangerClient(String hostName, String authType, String username, String password, String configFile) {
- restClient = new RangerRESTClient(hostName, configFile, new Configuration());
-
+ private void authInit(String authType, String username, String password) {
if (AUTH_KERBEROS.equalsIgnoreCase(authType)) {
if (SecureClientLogin.isKerberosCredentialExists(username, password)) {
isSecureMode = true;
@@ -159,6 +158,17 @@ public class RangerClient {
}
}
+ public RangerClient(String hostName, String authType, String username, String password, String configFile) {
+ restClient = new RangerRESTClient(hostName, configFile, new Configuration());
+ authInit(authType, username, password);
+ }
+
+ public RangerClient(String hostname, String authType, String username, String password, String appId, String serviceType){
+ this(hostname, authType, username, password,
+ new RangerPluginConfig(serviceType, null,appId,null,null,null)
+ .get("ranger.plugin." + serviceType + ".policy.rest.ssl.config.file"));
+ }
+
public RangerClient(RangerRESTClient restClient) {
this.restClient = restClient;