java.lang.Object
org.elasticsearch.xpack.core.security.xcontent.XContentUtils

public class XContentUtils extends Object
  • Method Details

    • verifyObject

      public static void verifyObject(XContentParser parser) throws IOException, ElasticsearchParseException
      Ensures that we're currently on the start of an object, or that the next token is a start of an object.
      Throws:
      ElasticsearchParseException - if the current or the next token is a START_OBJECT
      IOException
    • readStringArray

      public static String[] readStringArray(XContentParser parser, boolean allowNull) throws IOException
      Throws:
      IOException
    • addAuthorizationInfo

      public static void addAuthorizationInfo(XContentBuilder builder, Map<String,String> headers) throws IOException
      Adds information about the permissions that a background service will run as to the X-Content representation of its configuration: - If the permissions are based on a user's roles at the time the config was created then the list of these roles is added. - If the permissions come from an API key then the ID and name of the API key are added. - If the permissions come from a service account then the name of the service account is added.
      Parameters:
      builder - The XContentBuilder that the extra fields will be added to.
      headers - Security headers that were stored to determine which permissions a background service will run as. If null or no authentication key entry is present then no fields are added.
      Throws:
      IOException
    • addCloudApiKeyAuthorization

      public static void addCloudApiKeyAuthorization(XContentBuilder builder, String cloudApiKeyId) throws IOException
      Renders the UIAM cloud API key id as authorization.cloud_api_key.id — the shared GET-response shape used by datafeeds and transforms during UIAM switchover. Only the id is emitted; the secret is never included.
      Throws:
      IOException
    • maybeAddErrorDetails

      public static void maybeAddErrorDetails(XContentBuilder builder, Map<String,Exception> errors) throws IOException
      Throws:
      IOException