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 9fc74bf  RANGER-3266: Removed code to overwrite the Solr's Jaas config 
as part of initializing solr audit destination connection
9fc74bf is described below

commit 9fc74bfeef8420c9d753d3a8e2b8335af7cf5536
Author: Sailaja Polavarapu <spolavar...@cloudera.com>
AuthorDate: Mon May 3 08:25:03 2021 -0700

    RANGER-3266: Removed code to overwrite the Solr's Jaas config as part of 
initializing solr audit destination connection
---
 .../audit/destination/SolrAuditDestination.java    | 39 ----------------------
 .../solr/authorizer/RangerSolrAuthorizer.java      |  2 +-
 2 files changed, 1 insertion(+), 40 deletions(-)

diff --git 
a/agents-audit/src/main/java/org/apache/ranger/audit/destination/SolrAuditDestination.java
 
b/agents-audit/src/main/java/org/apache/ranger/audit/destination/SolrAuditDestination.java
index 5a7a7f4..8532bf8 100644
--- 
a/agents-audit/src/main/java/org/apache/ranger/audit/destination/SolrAuditDestination.java
+++ 
b/agents-audit/src/main/java/org/apache/ranger/audit/destination/SolrAuditDestination.java
@@ -184,9 +184,6 @@ public class SolrAuditDestination extends AuditDestination {
                                                        LOG.fatal("Can't 
connect to Solr server. ZooKeepers="
                                                                        + 
zkHosts, t);
                                                }
-                                               finally {
-                                                       
resetInitializerInSOLR();
-                                               }
                                        } else if (solrURLs != null && 
!solrURLs.isEmpty()) {
                                                try {
                                                        LOG.info("Connecting to 
Solr using URLs=" + solrURLs);
@@ -213,48 +210,12 @@ public class SolrAuditDestination extends 
AuditDestination {
                                                        LOG.fatal("Can't 
connect to Solr server. URL="
                                                                        + 
solrURLs, t);
                                                }
-                                               finally {
-                                                       
resetInitializerInSOLR();
-                                               }
                                        }
                                }
                        }
                }
        }
 
-
-    private void resetInitializerInSOLR() {
-               javax.security.auth.login.Configuration solrConfig = 
javax.security.auth.login.Configuration.getConfiguration();
-               String solrConfigClassName = solrConfig.getClass().getName();
-               String solrJassConfigEnd = "SolrJaasConfiguration";
-               if (solrConfigClassName.endsWith(solrJassConfigEnd)) {
-                       try {
-                               Field f = 
solrConfig.getClass().getDeclaredField("initiateAppNames");
-                               if (f != null) {
-                                       f.setAccessible(true);
-                                       HashSet<String> val = new 
HashSet<String>();
-                                       f.set(solrConfig, val);
-                                       if ( LOG.isDebugEnabled() ) {
-                                               
LOG.debug("resetInitializerInSOLR: successfully reset the initiateAppNames");
-                                       }
-
-                               } else {
-                                       if ( LOG.isDebugEnabled() ) {
-                                               
LOG.debug("resetInitializerInSOLR: not applying on class [" + 
solrConfigClassName + "] as it does not have initiateAppNames variable name.");
-                                       }
-                               }
-                       } catch (Throwable t) {
-                               logError("resetInitializerInSOLR: Unable to 
reset SOLRCONFIG.initiateAppNames to be empty", t);
-                       }
-               }
-               else {
-                       if ( LOG.isDebugEnabled() ) {
-                               LOG.debug("resetInitializerInSOLR: not applying 
on class [" + solrConfigClassName + "] as it does not endwith [" + 
solrJassConfigEnd + "]");
-                       }
-               }
-
-    }
-
        @Override
        public boolean log(Collection<AuditEventBase> events) {
                boolean ret = false;
diff --git 
a/plugin-solr/src/main/java/org/apache/ranger/authorization/solr/authorizer/RangerSolrAuthorizer.java
 
b/plugin-solr/src/main/java/org/apache/ranger/authorization/solr/authorizer/RangerSolrAuthorizer.java
index 1ebd0bf..200d037 100644
--- 
a/plugin-solr/src/main/java/org/apache/ranger/authorization/solr/authorizer/RangerSolrAuthorizer.java
+++ 
b/plugin-solr/src/main/java/org/apache/ranger/authorization/solr/authorizer/RangerSolrAuthorizer.java
@@ -224,7 +224,7 @@ public class RangerSolrAuthorizer extends SearchComponent 
implements Authorizati
                        logger.info("init(): KerberosName.rules="
                                        + MiscUtil.getKerberosNamesRules());
                } catch (Throwable t) {
-                       logger.fatal("Error creating and initializing 
RangerBasePlugin()");
+                       logger.fatal("Error creating and initializing 
RangerBasePlugin()", t);
                }
        }
 

Reply via email to