You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "kumaab (via GitHub)" <gi...@apache.org> on 2026/02/21 00:03:00 UTC

[PR] RANGER-5496: Decouple JWT lifecycle from Ranger plugin via pluggable JWT provider [ranger]

kumaab opened a new pull request, #857:
URL: https://github.com/apache/ranger/pull/857

   ## What changes were proposed in this pull request?
   
   Currently JWT is fetched during plugin initialization (via 3 different ways: env, file, cred file) and captured statically in the REST client filter. This enhancement introduces a pluggable JWT provider interface allowing services to manage JWT lifecycle independently while enabling Ranger plugins to fetch the latest JWT dynamically for each outbound REST call to Ranger Admin. PR includes a default implementation of `JwtProvider`.
   
   ## How was this patch tested?
   
   Pending
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5496: Decouple JWT lifecycle from Ranger plugin via pluggable JWT provider [ranger]

Posted by "mneethiraj (via GitHub)" <gi...@apache.org>.
mneethiraj commented on code in PR #857:
URL: https://github.com/apache/ranger/pull/857#discussion_r2844213982


##########
agents-common/src/main/java/org/apache/ranger/plugin/authn/DefaultJwtProvider.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.authn;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.ranger.authorization.hadoop.utils.RangerCredentialProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class DefaultJwtProvider implements JwtProvider {
+    private static final Logger LOG           = LoggerFactory.getLogger(DefaultJwtProvider.class);
+    public static final String JWT_SOURCE     = ".policy.rest.client.jwt.source";
+    public static final String JWT_ENV        = ".policy.rest.client.jwt.env";
+    public static final String JWT_FILE       = ".policy.rest.client.jwt.file";
+    public static final String JWT_CRED_FILE  = ".policy.rest.client.jwt.cred.file";
+    public static final String JWT_CRED_ALIAS = ".policy.rest.client.jwt.cred.alias";
+
+    private String jwt;
+
+    @Override
+    public String getJwt() {
+        return jwt;
+    }
+
+    public void setJwt(String propertyPrefix, Configuration config) {
+        final String jwtSrc = config.get(propertyPrefix + JWT_SOURCE);
+
+        if (StringUtils.isNotEmpty(jwtSrc)) {
+            switch (jwtSrc) {
+                case "env":
+                    String jwtEnvVar = config.get(propertyPrefix + JWT_ENV);
+                    if (StringUtils.isNotEmpty(jwtEnvVar)) {
+                        String jwtFromEnv = System.getenv(jwtEnvVar);
+                        if (StringUtils.isNotBlank(jwtFromEnv)) {
+                            jwt = jwtFromEnv;
+                        }
+                    }
+                    break;
+                case "file":
+                    String jwtFilePath = config.get(propertyPrefix + JWT_FILE);
+                    if (StringUtils.isNotEmpty(jwtFilePath)) {
+                        File jwtFile = new File(jwtFilePath);
+                        if (jwtFile.exists()) {
+                            try (BufferedReader reader = new BufferedReader(new FileReader(jwtFile))) {
+                                String line = null;
+                                while ((line = reader.readLine()) != null) {
+                                    if (StringUtils.isNotBlank(line) && !line.startsWith("#")) {
+                                        jwt = line;

Review Comment:
   Introduce `break;` after line 71?



##########
agents-common/src/main/java/org/apache/ranger/plugin/authn/DefaultJwtProvider.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.authn;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.ranger.authorization.hadoop.utils.RangerCredentialProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class DefaultJwtProvider implements JwtProvider {
+    private static final Logger LOG           = LoggerFactory.getLogger(DefaultJwtProvider.class);
+    public static final String JWT_SOURCE     = ".policy.rest.client.jwt.source";
+    public static final String JWT_ENV        = ".policy.rest.client.jwt.env";
+    public static final String JWT_FILE       = ".policy.rest.client.jwt.file";
+    public static final String JWT_CRED_FILE  = ".policy.rest.client.jwt.cred.file";
+    public static final String JWT_CRED_ALIAS = ".policy.rest.client.jwt.cred.alias";
+
+    private String jwt;
+
+    @Override
+    public String getJwt() {
+        return jwt;
+    }
+
+    public void setJwt(String propertyPrefix, Configuration config) {
+        final String jwtSrc = config.get(propertyPrefix + JWT_SOURCE);
+
+        if (StringUtils.isNotEmpty(jwtSrc)) {
+            switch (jwtSrc) {
+                case "env":
+                    String jwtEnvVar = config.get(propertyPrefix + JWT_ENV);
+                    if (StringUtils.isNotEmpty(jwtEnvVar)) {
+                        String jwtFromEnv = System.getenv(jwtEnvVar);
+                        if (StringUtils.isNotBlank(jwtFromEnv)) {
+                            jwt = jwtFromEnv;
+                        }
+                    }
+                    break;
+                case "file":
+                    String jwtFilePath = config.get(propertyPrefix + JWT_FILE);
+                    if (StringUtils.isNotEmpty(jwtFilePath)) {
+                        File jwtFile = new File(jwtFilePath);
+                        if (jwtFile.exists()) {
+                            try (BufferedReader reader = new BufferedReader(new FileReader(jwtFile))) {
+                                String line = null;
+                                while ((line = reader.readLine()) != null) {
+                                    if (StringUtils.isNotBlank(line) && !line.startsWith("#")) {
+                                        jwt = line;
+                                    }
+                                }
+                            } catch (IOException e) {
+                                LOG.error("Failed to read JWT from file: {}", jwtFilePath, e);
+                            }
+                        }
+                    }
+                    break;
+                case "cred":
+                    String credFilePath = config.get(propertyPrefix + JWT_CRED_FILE);
+                    String credAlias = config.get(propertyPrefix + JWT_CRED_ALIAS);
+                    if (StringUtils.isNotEmpty(credFilePath) && StringUtils.isNotEmpty(credAlias)) {
+                        String jwtFromCredFile = RangerCredentialProvider.getInstance().getCredentialString(credFilePath, credAlias);
+                        if (StringUtils.isNotBlank(jwt)) {

Review Comment:
   `jwt` => `jwtFromCredFile`



##########
agents-common/src/main/java/org/apache/ranger/plugin/authn/DefaultJwtProvider.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.authn;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.ranger.authorization.hadoop.utils.RangerCredentialProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class DefaultJwtProvider implements JwtProvider {
+    private static final Logger LOG           = LoggerFactory.getLogger(DefaultJwtProvider.class);
+    public static final String JWT_SOURCE     = ".policy.rest.client.jwt.source";

Review Comment:
   I suggest making `.policy.rest.client` part of `propertyPrefix` (line 48) to make this class generic for use in other contexts as well, like to fetch JWT to talk to services like Ranger KMS, Ranger RAZ, Ranger RMS, and other non-Ranger endpoints.



##########
agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPluginContext.java:
##########


Review Comment:
   Initialize `DefaultJwtProvider` instance with following call:
   `jwtProvider.setJwt(config.getPropertyPrefix() + ".policy.rest.client", config);`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5496: Decouple JWT lifecycle from Ranger plugin via pluggable JWT provider [ranger]

Posted by "kumaab (via GitHub)" <gi...@apache.org>.
kumaab commented on code in PR #857:
URL: https://github.com/apache/ranger/pull/857#discussion_r2849230642


##########
agents-common/src/main/java/org/apache/ranger/plugin/authn/DefaultJwtProvider.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.authn;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.ranger.authorization.hadoop.utils.RangerCredentialProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class DefaultJwtProvider implements JwtProvider {
+    private static final Logger LOG           = LoggerFactory.getLogger(DefaultJwtProvider.class);
+    public static final String JWT_SOURCE     = ".policy.rest.client.jwt.source";

Review Comment:
   Sure, makes sense.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5496: Decouple JWT lifecycle from Ranger plugin via pluggable JWT provider [ranger]

Posted by "kumaab (via GitHub)" <gi...@apache.org>.
kumaab commented on code in PR #857:
URL: https://github.com/apache/ranger/pull/857#discussion_r2849233465


##########
agents-common/src/main/java/org/apache/ranger/plugin/authn/DefaultJwtProvider.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.authn;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.ranger.authorization.hadoop.utils.RangerCredentialProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class DefaultJwtProvider implements JwtProvider {
+    private static final Logger LOG           = LoggerFactory.getLogger(DefaultJwtProvider.class);
+    public static final String JWT_SOURCE     = ".policy.rest.client.jwt.source";
+    public static final String JWT_ENV        = ".policy.rest.client.jwt.env";
+    public static final String JWT_FILE       = ".policy.rest.client.jwt.file";
+    public static final String JWT_CRED_FILE  = ".policy.rest.client.jwt.cred.file";
+    public static final String JWT_CRED_ALIAS = ".policy.rest.client.jwt.cred.alias";
+
+    private String jwt;
+
+    @Override
+    public String getJwt() {
+        return jwt;
+    }
+
+    public void setJwt(String propertyPrefix, Configuration config) {
+        final String jwtSrc = config.get(propertyPrefix + JWT_SOURCE);
+
+        if (StringUtils.isNotEmpty(jwtSrc)) {
+            switch (jwtSrc) {
+                case "env":
+                    String jwtEnvVar = config.get(propertyPrefix + JWT_ENV);
+                    if (StringUtils.isNotEmpty(jwtEnvVar)) {
+                        String jwtFromEnv = System.getenv(jwtEnvVar);
+                        if (StringUtils.isNotBlank(jwtFromEnv)) {
+                            jwt = jwtFromEnv;
+                        }
+                    }
+                    break;
+                case "file":
+                    String jwtFilePath = config.get(propertyPrefix + JWT_FILE);
+                    if (StringUtils.isNotEmpty(jwtFilePath)) {
+                        File jwtFile = new File(jwtFilePath);
+                        if (jwtFile.exists()) {
+                            try (BufferedReader reader = new BufferedReader(new FileReader(jwtFile))) {
+                                String line = null;
+                                while ((line = reader.readLine()) != null) {
+                                    if (StringUtils.isNotBlank(line) && !line.startsWith("#")) {
+                                        jwt = line;

Review Comment:
   yeah! missed it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5496: Decouple JWT lifecycle from Ranger plugin via pluggable JWT provider [ranger]

Posted by "mneethiraj (via GitHub)" <gi...@apache.org>.
mneethiraj commented on code in PR #857:
URL: https://github.com/apache/ranger/pull/857#discussion_r2849485476


##########
agents-common/src/main/java/org/apache/ranger/plugin/authn/DefaultJwtProvider.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.plugin.authn;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.ranger.authorization.hadoop.utils.RangerCredentialProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class DefaultJwtProvider implements JwtProvider {
+    private static final Logger LOG           = LoggerFactory.getLogger(DefaultJwtProvider.class);
+    public static final String JWT_SOURCE     = ".jwt.source";
+    public static final String JWT_ENV        = ".jwt.env";
+    public static final String JWT_FILE       = ".jwt.file";
+    public static final String JWT_CRED_FILE  = ".jwt.cred.file";
+    public static final String JWT_CRED_ALIAS = ".jwt.cred.alias";
+
+    private final String propertyPrefix;
+    private final Configuration config;
+    private String jwt;
+
+    public DefaultJwtProvider(String propertyPrefix, Configuration config){
+        this.propertyPrefix = propertyPrefix;
+        this.config = config;
+    }
+
+    @Override
+    public String getJwt() {

Review Comment:
   Consider initializing `jwt` in the constructor and have `getAwt()` method simply return it.
   
   ```
   public class DefaultJwtProvider implements JwtProvider {
       ...
       private final String jwt;
   
       public DefaultJwtProvider(String propertyPrefix, Configuration config) {
           ...
   
           this.jwt = readJwt();
       }
   
       @Override
       public String getJwt() {
           return jwt;
       }
   
       private String readJwt() {
           ...
       }



##########
agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTClient.java:
##########
@@ -773,14 +777,15 @@ private Client buildClient() {
         return client;
     }
 
-    private void setJWTFilter(String jwtAsString) {
-        if (StringUtils.isNotBlank(jwtAsString)) {
+    private void setJWTFilter() {
+        if (jwtProvider != null) {

Review Comment:
   Assign `this.jwtProvider` to a local variable before referencing it, to avoid potential NPE due to another thread calling `setJwtProvider(null)`.
   
   ```
   JwtProvider jwtProvider = this.jwtProvider;
   
   if (jwtProvider != null) {
      ...
   }



##########
agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPluginContext.java:
##########
@@ -163,6 +170,14 @@ public RangerAdminClient createAdminClient(RangerPluginConfig pluginConfig) {
         return ret;
     }
 
+    public void registerJWTProvider(JwtProvider jwtProvider) {
+        this.jwtProvider = jwtProvider;

Review Comment:
   `adminClient` should be updated of the new JwtProvider, right?
   
   ```
   RangerAdminRESTClient restClient = (adminClient instanceof RangerAdminRESTClient) ? (RangerAdminRESTClient) adminClient : null;
   
   if (restClient != null) {
     restClient.setJwtProvider(jwtProvider);
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5496: Decouple JWT lifecycle from Ranger plugin via pluggable JWT provider [ranger]

Posted by "kumaab (via GitHub)" <gi...@apache.org>.
kumaab merged PR #857:
URL: https://github.com/apache/ranger/pull/857


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5496: Decouple JWT lifecycle from Ranger plugin via pluggable JWT provider [ranger]

Posted by "kumaab (via GitHub)" <gi...@apache.org>.
kumaab commented on code in PR #857:
URL: https://github.com/apache/ranger/pull/857#discussion_r2849892479


##########
agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPluginContext.java:
##########
@@ -163,6 +170,14 @@ public RangerAdminClient createAdminClient(RangerPluginConfig pluginConfig) {
         return ret;
     }
 
+    public void registerJWTProvider(JwtProvider jwtProvider) {
+        this.jwtProvider = jwtProvider;

Review Comment:
   Yes!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5496: Decouple JWT lifecycle from Ranger plugin via pluggable JWT provider [ranger]

Posted by "kumaab (via GitHub)" <gi...@apache.org>.
kumaab commented on code in PR #857:
URL: https://github.com/apache/ranger/pull/857#discussion_r2850392307


##########
agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPluginContext.java:
##########
@@ -163,6 +170,19 @@ public RangerAdminClient createAdminClient(RangerPluginConfig pluginConfig) {
         return ret;
     }
 
+    public void registerJWTProvider(JwtProvider jwtProvider) {
+        this.jwtProvider = jwtProvider;
+
+        RangerAdminRESTClient restClient = (adminClient instanceof RangerAdminRESTClient) ? (RangerAdminRESTClient) adminClient : null;
+        if (restClient != null && jwtProvider != null) {

Review Comment:
   Sure, updated it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RANGER-5496: Decouple JWT lifecycle from Ranger plugin via pluggable JWT provider [ranger]

Posted by "mneethiraj (via GitHub)" <gi...@apache.org>.
mneethiraj commented on code in PR #857:
URL: https://github.com/apache/ranger/pull/857#discussion_r2850213526


##########
agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPluginContext.java:
##########
@@ -163,6 +170,19 @@ public RangerAdminClient createAdminClient(RangerPluginConfig pluginConfig) {
         return ret;
     }
 
+    public void registerJWTProvider(JwtProvider jwtProvider) {
+        this.jwtProvider = jwtProvider;
+
+        RangerAdminRESTClient restClient = (adminClient instanceof RangerAdminRESTClient) ? (RangerAdminRESTClient) adminClient : null;
+        if (restClient != null && jwtProvider != null) {

Review Comment:
   `jwtProvider != null` is not necessary here. In case plugin explicitly sets it to null, earlier value in `RangerAdminRESTClient` must be updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org