Class SolrCloudAuthTestCase

java.lang.Object
org.junit.Assert
org.apache.lucene.tests.util.LuceneTestCase

public class SolrCloudAuthTestCase extends SolrCloudTestCase
Base test class for cloud tests wanting to track authentication metrics. The assertions provided by this base class require a *minimum* count, not exact count from metrics. Warning: Make sure that your test case does not break when beasting.
  • Field Details

    • NOT_NULL_PREDICATE

      public static final Predicate NOT_NULL_PREDICATE
  • Constructor Details

    • SolrCloudAuthTestCase

      public SolrCloudAuthTestCase()
  • Method Details

    • enableMetrics

      public static void enableMetrics()
    • assertPkiAuthMetricsMinimums

      protected void assertPkiAuthMetricsMinimums(int requests, int authenticated, int passThrough, int failWrongCredentials, int failMissingCredentials, int errors)
      Used to check metric counts for PKI auth
    • assertAuthMetricsMinimums

      protected void assertAuthMetricsMinimums(Class<? extends org.apache.solr.security.AuthenticationPlugin> authPluginClass, int requests, int authenticated, int passThrough, int failWrongCredentials, int failMissingCredentials, int errors)
      Used to check metric counts for the AuthPlugin in use (except PKI)

      TODO: many of these params have to be under specified - this should wait a bit to see the desired params and timeout

    • verifySecurityStatus

      public static void verifySecurityStatus(org.eclipse.jetty.client.HttpClient httpClient, String url, String objPath, Object expected, int count) throws Exception
      Throws:
      Exception
    • verifySecurityStatus

      public static void verifySecurityStatus(org.eclipse.jetty.client.HttpClient httpClient, String url, String objPath, Object expected, int count, String user, String pwd) throws Exception
      Throws:
      Exception
    • verifySecurityStatus

      protected static void verifySecurityStatus(org.eclipse.jetty.client.HttpClient httpClient, String url, String objPath, Object expected, int count, String authHeader) throws Exception
      Throws:
      Exception
    • makeBasicAuthHeader

      protected static String makeBasicAuthHeader(String user, String pwd)
    • getAuthPluginsInUseForCluster

      public static Map<String,Object> getAuthPluginsInUseForCluster(String url)
      This helper method can be used by tests to monitor the current state of either "authentication" or "authorization" plugins in use each node of the current cluster.

      This can be useful in a TimeOut.waitFor(java.lang.String, java.util.function.Supplier<java.lang.Boolean>) loop to monitor a cluster and "wait for" A change in security settings to affect all nodes by comparing the objects in the current Map with the one in use prior to executing some test command. (providing a workaround for the security user experience limitations identified in SOLR-13464 )

      Parameters:
      url - A REST url (or any arbitrary String) ending in "authentication" or "authorization" used to specify the type of plugins to introspect
      Returns:
      A Map from nodeName to auth plugin