Example usage for javax.security.auth.login Configuration getClass

List of usage examples for javax.security.auth.login Configuration getClass

Introduction

In this page you can find the example usage for javax.security.auth.login Configuration getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.apache.ranger.audit.destination.SolrAuditDestination.java

private void resetInitializerInSOLR() {
    javax.security.auth.login.Configuration solrConfig = javax.security.auth.login.Configuration
            .getConfiguration();/*from ww  w.  j a  v  a 2s . c  om*/
    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 + "]");
        }
    }

}