Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
6b83527
Fix plaintext on TLS port logging (#45852)
Aug 26, 2019
42690d0
Add Test Logging for #45953 (#45957)
original-brownbear Aug 26, 2019
fbecbcf
[DOCS] Reformat create index API docs (#45749)
jrodewig Aug 26, 2019
2599e23
Fix SnapshotStatusApisIT (#45929)
original-brownbear Aug 26, 2019
e003b70
Fix Broken HTTP Request Breaking Channel Closing (#45958)
original-brownbear Aug 26, 2019
a526d9c
Refactor RepositoryCredentialsTests (#45919)
tlrx Aug 26, 2019
ebec18e
[DOCS] Reformat get settings API docs (#45924)
jrodewig Aug 26, 2019
4f52ebd
Better logging for TLS message on non-secure transport channel (#45835)
Aug 26, 2019
f0b7c01
Relax translog assertion in testRestoreLocalHistoryFromTranslog (#45943)
dnhatn Aug 26, 2019
ebef8bf
Consider artifact repositories backed by S3 secure (#45950)
jasontedor Aug 26, 2019
5f6f388
Build: Support `console-result` language (#45937)
nik9000 Aug 26, 2019
f12ea8a
[DOCS] Reformat indices exists API docs (#45918)
jrodewig Aug 26, 2019
f4703be
[DOCS] Reformat get field mapping API docs (#45700)
jrodewig Aug 26, 2019
273c35f
Add Cumulative Cardinality agg (and Data Science plugin) (#43661)
Aug 26, 2019
fbbd749
[DOCS] Correct `IIF` conditional section title (#45979)
jrodewig Aug 26, 2019
b06dda2
Fix typo in plugin name, add to allowed settings
Aug 26, 2019
715f7e9
PKI realm authentication delegation (#45906)
albertzaharovits Aug 26, 2019
527334d
[ML] fixing bug where analytics process starts with 0 rows (#45879)
benwtrent Aug 26, 2019
cf651ec
[ML] add supported types to no fields error message (#45926)
benwtrent Aug 26, 2019
1a0dddf
Range Field support for Histogram and Date Histogram aggregations(#45…
not-napoleon Aug 26, 2019
3eae13f
[TEST] wait for search task to be cancelled in SearchRestCancellation…
javanna Aug 26, 2019
268881e
Remove node settings from blob store repositories (#45991)
jasontedor Aug 26, 2019
b237721
[DOCS] Streamline GS search topic. (#45941)
debadair Aug 26, 2019
361d637
Add test for CopyBytesSocketChannel (#45873)
Tim-Brooks Aug 26, 2019
54ccdc7
Do not create engine under IndexShard#mutex (#45263)
dnhatn Aug 26, 2019
8ff48d8
Fix compilation in CumulativeCardinalityAggregatorTests (#46000)
dakrone Aug 26, 2019
bac1707
[DOCS] Streamlined GS aggs section. (#45951)
debadair Aug 26, 2019
de717a8
Don't use assemble task on root project (#45999)
rjernst Aug 26, 2019
db69329
[DOCS] Fix typo. (#46006)
debadair Aug 27, 2019
6b15079
[TEST] wait for http channels to be closed in ESIntegTestCase (#45977)
javanna Aug 27, 2019
5761b0a
Add `manage_own_api_key` cluster privilege (#45897)
bizybot Aug 27, 2019
1a4f81e
Partly revert globalInfo.ready check (#45960)
jkakavas Aug 27, 2019
c80891e
[ML] Add option to regression to randomize training set (#45969)
dimitris-athanasiou Aug 27, 2019
a102788
Disallow partial results when shard unavailable (#45739)
henningandersen Aug 27, 2019
0d78adf
[DOCS] Reformat open index API docs (#45921)
jrodewig Aug 27, 2019
ca22659
Fix RegressionTests#fromXContent (#46029)
original-brownbear Aug 27, 2019
59003f1
[DOCS] Separate and reformat close index API docs (#45922)
jrodewig Aug 27, 2019
e85dcb4
Remove already exist assertion while renew ccr lease (#46009)
dnhatn Aug 27, 2019
859e387
Watcher max_iterations with foreach action execution (#45715)
jbonn360 Aug 27, 2019
8109a2c
[DOCS] Reformat update index settings API docs (#45931)
jrodewig Aug 27, 2019
fd3488d
Always add Java-9 style file permissions (#46050)
jasontedor Aug 28, 2019
eab6425
[ML][HLRC] Add data frame analytics regression analysis (#46024)
dimitris-athanasiou Aug 28, 2019
9c6d9a9
[ML] Support boolean fields for DF analytics (#46037)
dimitris-athanasiou Aug 28, 2019
e40be72
Add a few notes on Cancellable to the LLRC and HLRC docs. (#45912)
jillesvangurp Aug 28, 2019
525cc77
[DOCS] [8.0] Add upgrade matrix to docs (#46027)
jrodewig Aug 28, 2019
05cb601
[DOCS] Add index alias exists API docs (#46042)
jrodewig Aug 28, 2019
1dcc4ed
Few clean ups in ESBlobStoreRepositoryIntegTestCase (#46068)
tlrx Aug 28, 2019
2b1ebd6
Add XContentType as parameter to HLRC ART#createServerTestInstance (#…
martijnvg Aug 28, 2019
3b9a10f
Fix rollover alias in SLM history index template (#46001)
gwbrown Aug 28, 2019
3251466
Handle no-op document level failures (#46083)
jasontedor Aug 28, 2019
8a337ce
Remove plugins dir reference from docs (#46047)
rjernst Aug 28, 2019
056c2bd
Fix rest-api-spec dep for external plugins (#45949)
rjernst Aug 28, 2019
8d16c9b
Use float instead of double for query vectors. (#46004)
jtibshirani Aug 28, 2019
e1c060a
Add Circle Processor (#43851)
talevy Aug 28, 2019
9f716fb
[ML] Throw an error when a datafeed needs CCS but it is not enabled f…
benwtrent Aug 28, 2019
47fd1f2
Muting org.elasticsearch.client.MachineLearningIT.testEstimateMemoryU…
benwtrent Aug 28, 2019
6ba13e9
[DOCS] Adds search-related query parameters to the common parameters.…
szabosteve Aug 28, 2019
28e93ce
Move netty numDirectArenas to jvm.options (#46104)
Tim-Brooks Aug 29, 2019
a2d4b81
Handle delete document level failures (#46100)
jasontedor Aug 29, 2019
2dcdbc9
[DOCS] Reformats delete by query API (#46051)
debadair Aug 29, 2019
cb2e732
Flush engine after big merge (#46066)
s1monw Aug 29, 2019
02abb1a
Docs _cat/health verification fix (#46064)
henningandersen Aug 29, 2019
8cc4194
Do not throw an exception if the process finished quickly but without…
przemekwitek Aug 29, 2019
a6e915b
[DOCS] Reformats URI search request (#45844)
szabosteve Aug 29, 2019
6d25719
DOC: Update SQL docs for DbVis and Workbench/J (#45981)
costin Aug 29, 2019
f7fedc3
Upgrade to Azure SDK 8.4.0 (#46094)
original-brownbear Aug 29, 2019
38cf581
Use better matchers in AbstractSimpleTransportTestCase (#45899)
pugnascotia Aug 29, 2019
8ca0d4b
Refactor auditor-related classes (#45893)
przemekwitek Aug 29, 2019
47f617d
Unmute the test now that the fix for the underlying cause is merged i…
przemekwitek Aug 29, 2019
7dbf2df
Replace MockAmazonS3 usage in S3BlobStoreRepositoryTests by a HTTP se…
tlrx Aug 29, 2019
70b8d7b
Avoid overshooting watermarks during relocation (#46079)
DaveCTurner Aug 29, 2019
71ead75
AwaitsFix for #46124
DaveCTurner Aug 29, 2019
164f1a0
Revert "Use better matchers in AbstractSimpleTransportTestCase (#45899)"
pugnascotia Aug 29, 2019
0c5c391
Revert "AwaitsFix for #46124"
pugnascotia Aug 29, 2019
626bbcc
[DOCS] [PUT DFA] Documents inline the child params of source and dest…
szabosteve Aug 29, 2019
ec29542
Only verify global checkpoint if translog sync occurred (#45980)
dnhatn Aug 29, 2019
64691a4
Start testing against AdoptOpenJDK (#45666)
jasontedor Aug 29, 2019
676433e
[DOCS] Reformats analyze API (#45986)
jrodewig Aug 29, 2019
947fccb
[DOCS] Add get index alias API docs (#46046)
jrodewig Aug 29, 2019
afdd000
Validate SLM policy ids strictly (#45998)
dakrone Aug 29, 2019
4cf5ffa
More Efficient Ordering of Shard Upload Execution (#42791)
original-brownbear Aug 29, 2019
be7b873
[DOCS] Correct custom analyzer callouts (#46030)
jrodewig Aug 29, 2019
bf71108
Rename `data-science` plugin to `analytics` (#46092)
Aug 29, 2019
effb650
[DOCS] Separate add index alias API docs (#46086)
jrodewig Aug 29, 2019
f61515b
[DOCS] Reformat update index aliases API docs (#46093)
jrodewig Aug 29, 2019
9ae7393
[ML] Regression dependent variable must be numeric (#46072)
dimitris-athanasiou Aug 29, 2019
05d8e80
Ensure top docs optimization is fully disabled for queries with unbou…
jtibshirani Aug 29, 2019
6b01043
[DOCS] Add "index template exists" API docs (#46095)
jrodewig Aug 29, 2019
75b7b01
[DOCS] Add "delete index template" API docs (#46101)
jrodewig Aug 29, 2019
55d4581
Remove classic similarity (#46078)
jimczi Aug 29, 2019
80f2a40
Add package docs for bundled jdk location (#46153)
rjernst Aug 29, 2019
131a8de
bump version (#46158)
Aug 29, 2019
12b76b8
Set netty system properties in BuildPlugin (#45881)
Tim-Brooks Aug 29, 2019
2bcfe1a
Remove insecure settings (#46147)
jasontedor Aug 30, 2019
bf838f6
Inject random errors in S3BlobStoreRepositoryTests (#46125)
tlrx Aug 30, 2019
3179a0c
Forbid settings without a namespace (#45947)
jasontedor Aug 30, 2019
911d02b
Enhanced logging when transport is misconfigured to talk to HTTP port…
Aug 30, 2019
45268ec
Fix wrong URL encoding in watcher HTTP client (#45894)
spinscale Aug 30, 2019
0c27d0f
Fix translog stats in testPrepareIndexForPeerRecovery (#46137)
dnhatn Aug 30, 2019
121576d
Make Snapshot Logic Write Metadata after Segments (#45689)
original-brownbear Aug 30, 2019
42c7449
[TEST] Mute PinnedQueryBuilderIT.testPinnedPromotions (#46175)
dimitris-athanasiou Aug 30, 2019
1be991d
Move plugin.mandatory to installing plugins docs
jasontedor Aug 30, 2019
2ced1b0
Move plugin.mandatory to its own page
jasontedor Aug 30, 2019
3499b58
Add test tasks for unpooled and direct buffer pooling to netty (#46049)
rjernst Aug 30, 2019
1e676ab
Stabilize SLM REST Tests (#46195)
original-brownbear Aug 31, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .ci/bwcVersions
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ BWC_VERSION:
- "7.3.1"
- "7.3.2"
- "7.4.0"
- "7.5.0"
- "8.0.0"
2 changes: 1 addition & 1 deletion .ci/java-versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# are 'java' or 'openjdk' followed by the major release number.

ES_BUILD_JAVA=openjdk12
ES_RUNTIME_JAVA=java11
ES_RUNTIME_JAVA=openjdk11
GRADLE_TASK=build


1 change: 1 addition & 0 deletions .ci/matrix-runtime-javas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ ES_RUNTIME_JAVA:
- zulu11
- zulu12
- corretto11
- adoptopenjdk11
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import static org.elasticsearch.gradle.tool.Boilerplate.maybeConfigure

plugins {
id 'com.gradle.build-scan' version '2.4'
id 'base'
id 'lifecycle-base'
id 'elasticsearch.global-build-info'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import org.gradle.api.artifacts.ModuleVersionIdentifier
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.ResolvedArtifact
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.ArtifactRepository
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.api.artifacts.repositories.IvyPatternRepositoryLayout
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
Expand Down Expand Up @@ -85,12 +84,10 @@ import org.gradle.util.GradleVersion

import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.time.ZoneOffset
import java.time.ZonedDateTime
import java.util.regex.Matcher

import static org.elasticsearch.gradle.tool.Boilerplate.maybeConfigure
import static org.elasticsearch.gradle.tool.Boilerplate.findByName
import static org.elasticsearch.gradle.tool.Boilerplate.maybeConfigure

/**
* Encapsulates build configuration for elasticsearch projects.
Expand Down Expand Up @@ -411,11 +408,11 @@ class BuildPlugin implements Plugin<Project> {
project.getRepositories().all { repository ->
if (repository instanceof MavenArtifactRepository) {
final MavenArtifactRepository maven = (MavenArtifactRepository) repository
assertRepositoryURIUsesHttps(maven, project, maven.getUrl())
repository.getArtifactUrls().each { uri -> assertRepositoryURIUsesHttps(maven, project, uri) }
assertRepositoryURIIsSecure(maven.name, project.path, maven.getUrl())
repository.getArtifactUrls().each { uri -> assertRepositoryURIIsSecure(maven.name, project.path, uri) }
} else if (repository instanceof IvyArtifactRepository) {
final IvyArtifactRepository ivy = (IvyArtifactRepository) repository
assertRepositoryURIUsesHttps(ivy, project, ivy.getUrl())
assertRepositoryURIIsSecure(ivy.name, project.path, ivy.getUrl())
}
}
RepositoryHandler repos = project.repositories
Expand Down Expand Up @@ -455,9 +452,15 @@ class BuildPlugin implements Plugin<Project> {
}
}

private static void assertRepositoryURIUsesHttps(final ArtifactRepository repository, final Project project, final URI uri) {
if (uri != null && uri.toURL().getProtocol().equals("http")) {
throw new GradleException("repository [${repository.name}] on project with path [${project.path}] is using http for artifacts on [${uri.toURL()}]")
static void assertRepositoryURIIsSecure(final String repositoryName, final String projectPath, final URI uri) {
if (uri != null && ["file", "https", "s3"].contains(uri.getScheme()) == false) {
final String message = String.format(
Locale.ROOT,
"repository [%s] on project with path [%s] is not using a secure protocol for artifacts on [%s]",
repositoryName,
projectPath,
uri.toURL())
throw new GradleException(message)
}
}

Expand Down Expand Up @@ -884,6 +887,12 @@ class BuildPlugin implements Plugin<Project> {
// TODO: remove this once cname is prepended to transport.publish_address by default in 8.0
test.systemProperty 'es.transport.cname_in_publish_address', 'true'

// Set netty system properties to the properties we configure in jvm.options
test.systemProperty('io.netty.noUnsafe', 'true')
test.systemProperty('io.netty.noKeySetOptimization', 'true')
test.systemProperty('io.netty.recycler.maxCapacityPerThread', '0')
test.systemProperty('io.netty.allocator.numDirectArenas', '0')

test.testLogging { TestLoggingContainer logging ->
logging.showExceptions = true
logging.showCauses = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public class SnippetsTask extends DefaultTask {
}
}
if (snippet.testResponse
&& 'js' == snippet.language
&& ('js' == snippet.language || 'console-result' == snippet.language)
&& null == snippet.skip) {
String quoted = snippet.contents
// quote values starting with $
Expand Down Expand Up @@ -162,7 +162,7 @@ public class SnippetsTask extends DefaultTask {
}
return
}
matcher = line =~ /\["?source"?,\s*"?(\w+)"?(,.*)?].*/
matcher = line =~ /\["?source"?,\s*"?([-\w]+)"?(,.*)?].*/
if (matcher.matches()) {
lastLanguage = matcher.group(1)
lastLanguageLine = lineNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class RestIntegTestTask extends DefaultTask {
}
project.dependencies {
restSpec ClasspathUtils.isElasticsearchProject() ? project.project(':rest-api-spec') :
"org.elasticsearch.rest-api-spec:${VersionProperties.elasticsearch}"
"org.elasticsearch:rest-api-spec:${VersionProperties.elasticsearch}"
}
Task copyRestSpec = project.tasks.findByName('copyRestSpec')
if (copyRestSpec != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
import org.gradle.api.GradleException;
import org.junit.Test;

import java.net.URI;
import java.net.URISyntaxException;


public class BuildPluginTests extends GradleUnitTestCase {

Expand All @@ -36,4 +39,25 @@ public void testFailingDockerVersions() {
BuildPlugin.checkDockerVersionRecent("Docker version 17.04.0, build e68fc7a");
}

@Test(expected = GradleException.class)
public void testRepositoryURIThatUsesHttpScheme() throws URISyntaxException {
final URI uri = new URI("http://s3.amazonaws.com/artifacts.elastic.co/maven");
BuildPlugin.assertRepositoryURIIsSecure("test", "test", uri);
}

public void testRepositoryThatUsesFileScheme() throws URISyntaxException {
final URI uri = new URI("file:/tmp/maven");
BuildPlugin.assertRepositoryURIIsSecure("test", "test", uri);
}

public void testRepositoryURIThatUsesHttpsScheme() throws URISyntaxException {
final URI uri = new URI("https://s3.amazonaws.com/artifacts.elastic.co/maven");
BuildPlugin.assertRepositoryURIIsSecure("test", "test", uri);
}

public void testRepositoryURIThatUsesS3Scheme() throws URISyntaxException {
final URI uri = new URI("s3://artifacts.elastic.co/maven");
BuildPlugin.assertRepositoryURIIsSecure("test", "test", uri);
}

}
55 changes: 55 additions & 0 deletions buildSrc/src/test/java/org/elasticsearch/gradle/BuildPluginIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,29 @@
*/
package org.elasticsearch.gradle;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.elasticsearch.gradle.test.GradleIntegrationTestCase;
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.GradleRunner;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class BuildPluginIT extends GradleIntegrationTestCase {

@Rule
public TemporaryFolder tmpDir = new TemporaryFolder();

public void testPluginCanBeApplied() {
BuildResult result = getGradleRunner("elasticsearch.build")
.withArguments("hello", "-s")
Expand All @@ -46,6 +56,51 @@ public void testCheckTask() {
assertTaskSuccessful(result, ":check");
}

public void testInsecureMavenRepository() throws IOException {
final String name = "elastic-maven";
final String url = "http://s3.amazonaws.com/artifacts.elastic.co/maven";
// add an insecure maven repository to the build.gradle
final List<String> lines = Arrays.asList(
"repositories {",
" maven {",
" name \"elastic-maven\"",
" url \"" + url + "\"\n",
" }",
"}");
runInsecureArtifactRepositoryTest(name, url, lines);
}

public void testInsecureIvyRepository() throws IOException {
final String name = "elastic-ivy";
final String url = "http://s3.amazonaws.com/artifacts.elastic.co/ivy";
// add an insecure ivy repository to the build.gradle
final List<String> lines = Arrays.asList(
"repositories {",
" ivy {",
" name \"elastic-ivy\"",
" url \"" + url + "\"\n",
" }",
"}");
runInsecureArtifactRepositoryTest(name, url, lines);
}

private void runInsecureArtifactRepositoryTest(final String name, final String url, final List<String> lines) throws IOException {
final File projectDir = getProjectDir("elasticsearch.build");
FileUtils.copyDirectory(projectDir, tmpDir.getRoot(), pathname -> pathname.getPath().contains("/build/") == false);
final List<String> buildGradleLines =
Files.readAllLines(tmpDir.getRoot().toPath().resolve("build.gradle"), StandardCharsets.UTF_8);
buildGradleLines.addAll(lines);
Files.write(tmpDir.getRoot().toPath().resolve("build.gradle"), buildGradleLines, StandardCharsets.UTF_8);
final BuildResult result = GradleRunner.create()
.withProjectDir(tmpDir.getRoot())
.withArguments("clean", "hello", "-s", "-i", "--warning-mode=all", "--scan")
.withPluginClasspath()
.buildAndFail();
assertOutputContains(
result.getOutput(),
"repository [" + name + "] on project with path [:] is not using a secure protocol for artifacts on [" + url + "]");
}

public void testLicenseAndNotice() throws IOException {
BuildResult result = getGradleRunner("elasticsearch.build")
.withArguments("clean", "assemble", "-s", "-Dlocal.repo.path=" + getLocalTestRepoPath())
Expand Down
9 changes: 9 additions & 0 deletions client/rest-high-level/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ processTestResources {
from({ zipTree(configurations.restSpec.singleFile) }) {
include 'rest-api-spec/api/**'
}
from(project(':client:rest-high-level').file('src/test/resources'))
}

dependencyLicenses {
Expand Down Expand Up @@ -117,6 +118,7 @@ if (isEclipse) {

File nodeCert = file("./testnode.crt")
File nodeTrustStore = file("./testnode.jks")
File pkiTrustCert = file("./src/test/resources/org/elasticsearch/client/security/delegate_pki/testRootCA.crt")

integTest.runner {
systemProperty 'tests.rest.cluster.username', System.getProperty('tests.rest.cluster.username', 'test_user')
Expand All @@ -134,11 +136,18 @@ testClusters.integTest {
// Truststore settings are not used since TLS is not enabled. Included for testing the get certificates API
setting 'xpack.security.http.ssl.certificate_authorities', 'testnode.crt'
setting 'xpack.security.transport.ssl.truststore.path', 'testnode.jks'
setting 'xpack.security.authc.realms.file.default_file.order', '0'
setting 'xpack.security.authc.realms.native.default_native.order', '1'
setting 'xpack.security.authc.realms.pki.pki1.order', '2'
setting 'xpack.security.authc.realms.pki.pki1.certificate_authorities', '[ "testRootCA.crt" ]'
setting 'xpack.security.authc.realms.pki.pki1.delegation.enabled', 'true'

setting 'indices.lifecycle.poll_interval', '1000ms'
keystore 'xpack.security.transport.ssl.truststore.secure_password', 'testnode'
user username: System.getProperty('tests.rest.cluster.username', 'test_user'),
password: System.getProperty('tests.rest.cluster.password', 'test-password')

extraConfigFile nodeCert.name, nodeCert
extraConfigFile nodeTrustStore.name, nodeTrustStore
extraConfigFile pkiTrustCert.name, pkiTrustCert
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import org.elasticsearch.client.security.CreateApiKeyResponse;
import org.elasticsearch.client.security.CreateTokenRequest;
import org.elasticsearch.client.security.CreateTokenResponse;
import org.elasticsearch.client.security.DelegatePkiAuthenticationRequest;
import org.elasticsearch.client.security.DelegatePkiAuthenticationResponse;
import org.elasticsearch.client.security.DeletePrivilegesRequest;
import org.elasticsearch.client.security.DeletePrivilegesResponse;
import org.elasticsearch.client.security.DeleteRoleMappingRequest;
Expand Down Expand Up @@ -1005,4 +1007,39 @@ public Cancellable invalidateApiKeyAsync(final InvalidateApiKeyRequest request,
return restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::invalidateApiKey, options,
InvalidateApiKeyResponse::fromXContent, listener, emptySet());
}

/**
* Get an Elasticsearch access token from an {@code X509Certificate} chain. The certificate chain is that of the client from a mutually
* authenticated TLS session, and it is validated by the PKI realms with {@code delegation.enabled} toggled to {@code true}.<br>
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delegate-pki-authentication.html"> the
* docs</a> for more details.
*
* @param request the request containing the certificate chain
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the response from the delegate-pki-authentication API key call
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public DelegatePkiAuthenticationResponse delegatePkiAuthentication(DelegatePkiAuthenticationRequest request, RequestOptions options)
throws IOException {
return restHighLevelClient.performRequestAndParseEntity(request, SecurityRequestConverters::delegatePkiAuthentication, options,
DelegatePkiAuthenticationResponse::fromXContent, emptySet());
}

/**
* Asynchronously get an Elasticsearch access token from an {@code X509Certificate} chain. The certificate chain is that of the client
* from a mutually authenticated TLS session, and it is validated by the PKI realms with {@code delegation.enabled} toggled to
* {@code true}.<br>
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delegate-pki-authentication.html"> the
* docs</a> for more details.
*
* @param request the request containing the certificate chain
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public Cancellable delegatePkiAuthenticationAsync(DelegatePkiAuthenticationRequest request, RequestOptions options,
ActionListener<DelegatePkiAuthenticationResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::delegatePkiAuthentication, options,
DelegatePkiAuthenticationResponse::fromXContent, listener, emptySet());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.client.security.ClearRolesCacheRequest;
import org.elasticsearch.client.security.CreateApiKeyRequest;
import org.elasticsearch.client.security.CreateTokenRequest;
import org.elasticsearch.client.security.DelegatePkiAuthenticationRequest;
import org.elasticsearch.client.security.DeletePrivilegesRequest;
import org.elasticsearch.client.security.DeleteRoleMappingRequest;
import org.elasticsearch.client.security.DeleteRoleRequest;
Expand Down Expand Up @@ -221,6 +222,12 @@ static Request createToken(CreateTokenRequest createTokenRequest) throws IOExcep
return request;
}

static Request delegatePkiAuthentication(DelegatePkiAuthenticationRequest delegatePkiAuthenticationRequest) throws IOException {
Request request = new Request(HttpPost.METHOD_NAME, "/_security/delegate_pki");
request.setEntity(createEntity(delegatePkiAuthenticationRequest, REQUEST_BODY_CONTENT_TYPE));
return request;
}

static Request invalidateToken(InvalidateTokenRequest invalidateTokenRequest) throws IOException {
Request request = new Request(HttpDelete.METHOD_NAME, "/_security/oauth2/token");
request.setEntity(createEntity(invalidateTokenRequest, REQUEST_BODY_CONTENT_TYPE));
Expand Down Expand Up @@ -294,7 +301,7 @@ static Request getApiKey(final GetApiKeyRequest getApiKeyRequest) throws IOExcep
if (Strings.hasText(getApiKeyRequest.getRealmName())) {
request.addParameter("realm_name", getApiKeyRequest.getRealmName());
}

request.addParameter("owner", Boolean.toString(getApiKeyRequest.ownedByAuthenticatedUser()));
return request;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public List<NamedXContentRegistry.Entry> getNamedXContentParsers() {
new NamedXContentRegistry.Entry(
DataFrameAnalysis.class,
OutlierDetection.NAME,
(p, c) -> OutlierDetection.fromXContent(p)));
(p, c) -> OutlierDetection.fromXContent(p)),
new NamedXContentRegistry.Entry(
DataFrameAnalysis.class,
Regression.NAME,
(p, c) -> Regression.fromXContent(p)));
}
}
Loading