Module org.elasticsearch.xcore
Class XContentUtils
java.lang.Object
org.elasticsearch.xpack.core.security.xcontent.XContentUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAuthorizationInfo(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 voidaddCloudApiKeyAuthorization(XContentBuilder builder, String cloudApiKeyId) Renders the UIAM cloud API key id asauthorization.cloud_api_key.id— the shared GET-response shape used by datafeeds and transforms during UIAM switchover.static voidmaybeAddErrorDetails(XContentBuilder builder, Map<String, Exception> errors) static String[]readStringArray(XContentParser parser, boolean allowNull) static voidverifyObject(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(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
- Throws:
IOException
-
addAuthorizationInfo
public static void addAuthorizationInfo(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
-
addCloudApiKeyAuthorization
public static void addCloudApiKeyAuthorization(XContentBuilder builder, String cloudApiKeyId) throws IOException Renders the UIAM cloud API key id asauthorization.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
-