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

public class XContentUtils extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addAuthorizationInfo(org.elasticsearch.xcontent.XContentBuilder builder, Map<String,String> headers)
    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.
    static void
    maybeAddErrorDetails(org.elasticsearch.xcontent.XContentBuilder builder, Map<String,Exception> errors)
     
    static String[]
    readStringArray(org.elasticsearch.xcontent.XContentParser parser, boolean allowNull)
     
    static void
    verifyObject(org.elasticsearch.xcontent.XContentParser parser)
    Ensures that we're currently on the start of an object, or that the next token is a start of an object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • verifyObject

      public static void verifyObject(org.elasticsearch.xcontent.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(org.elasticsearch.xcontent.XContentParser parser, boolean allowNull) throws IOException
      Throws:
      IOException
    • addAuthorizationInfo

      public static void addAuthorizationInfo(org.elasticsearch.xcontent.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
    • maybeAddErrorDetails

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