Module org.elasticsearch.xcore
Class XContentUtils
java.lang.Object
org.elasticsearch.xpack.core.security.xcontent.XContentUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAuthorizationInfo(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 voidmaybeAddErrorDetails(org.elasticsearch.xcontent.XContentBuilder builder, Map<String, Exception> errors) static String[]readStringArray(org.elasticsearch.xcontent.XContentParser parser, boolean allowNull) static voidverifyObject(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.
-
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 aSTART_OBJECTIOException
-
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 IOExceptionAdds 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- TheXContentBuilderthat the extra fields will be added to.headers- Security headers that were stored to determine which permissions a background service will run as. Ifnullor 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
-