-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OIDC authentication Integration Tests #40262
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
bb1096b
Add OIDC authentication Integration Tests
jkakavas 67c3f63
Merge branch 'feature-oidc-realm' into oidc-realm-IT
jkakavas 5419310
remove superfluous config examples
jkakavas cd0b221
Replace java mail with jakarta mail (see #40088)
jkakavas 312807f
update jar SHA
jkakavas 368f0f6
Merge branch 'feature-oidc-realm' into oidc-realm-IT
jkakavas 6bd3ecb
address feedback
jkakavas 50e8741
Merge branch 'feature-oidc-realm' into oidc-realm-IT
jkakavas e76f1da
Adjust after TokenService refactoring
jkakavas 670df71
add necessary files for jakarta.mail
jkakavas c583a9a
use ephemeral ports instead of hardcoded ones for oidc-provider
jkakavas 5147c2c
Adjust time fixing in tests to reduce possibility for random failures
jkakavas a6ce674
address feedback
jkakavas 9f24682
Merge remote-tracking branch 'origin/feature-oidc-realm' into oidc-re…
jkakavas fb76140
Use c2id internal user for testing
jkakavas b21abec
address feedback
jkakavas b4fac58
move onlyIf in the task
jkakavas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
787e007e377223bba85a33599d3da416c135f99b |
637 changes: 637 additions & 0 deletions
637
x-pack/plugin/security/licenses/jakarta.mail-LICENSE.txt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Notices for Eclipse Project for JavaMail | ||
|
||
This content is produced and maintained by the Eclipse Project for JavaMail | ||
project. | ||
|
||
* Project home: https://projects.eclipse.org/projects/ee4j.javamail | ||
|
||
## Trademarks | ||
|
||
Eclipse Project for JavaMail is a trademark of the Eclipse Foundation. | ||
|
||
## Copyright | ||
|
||
All content is the property of the respective authors or their employers. For | ||
more information regarding authorship of content, please consult the listed | ||
source code repository logs. | ||
|
||
## Declared Project Licenses | ||
|
||
This program and the accompanying materials are made available under the terms | ||
of the Eclipse Public License v. 2.0 which is available at | ||
http://www.eclipse.org/legal/epl-2.0. This Source Code may also be made | ||
available under the following Secondary Licenses when the conditions for such | ||
availability set forth in the Eclipse Public License v. 2.0 are satisfied: GNU | ||
General Public License, version 2 with the GNU Classpath Exception which is | ||
available at https://www.gnu.org/software/classpath/license.html. | ||
|
||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
|
||
## Source Code | ||
|
||
The project maintains the following source code repositories: | ||
|
||
* https://github.com/eclipse-ee4j/javamail | ||
|
||
## Third-party Content | ||
|
||
This project leverages the following third party content. | ||
|
||
None | ||
|
||
## Cryptography | ||
|
||
Content may contain encryption software. The country in which you are currently | ||
may have restrictions on the import, possession, and use, and/or re-export to | ||
another country, of encryption software. BEFORE using any encryption software, | ||
please check the country's laws, regulations and policies concerning the import, | ||
possession, or use, and re-export of encryption software, to see if this is | ||
permitted. | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
Project idpFixtureProject = xpackProject("test:idp-fixture") | ||
|
||
apply plugin: 'elasticsearch.standalone-rest-test' | ||
apply plugin: 'elasticsearch.rest-test' | ||
apply plugin: 'elasticsearch.test.fixtures' | ||
|
||
dependencies { | ||
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here | ||
testCompile project(path: xpackModule('core'), configuration: 'default') | ||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts') | ||
testCompile project(path: xpackModule('security'), configuration: 'testArtifacts') | ||
} | ||
testFixtures.useFixture ":x-pack:test:idp-fixture" | ||
|
||
String ephemeralPort; | ||
task setupPorts { | ||
// Don't attempt to get ephemeral ports when Docker is not available | ||
onlyIf { idpFixtureProject.postProcessFixture.enabled } | ||
dependsOn idpFixtureProject.postProcessFixture | ||
doLast { | ||
ephemeralPort = idpFixtureProject.postProcessFixture.ext."test.fixtures.oidc-provider.tcp.8080" | ||
} | ||
} | ||
|
||
integTestCluster { | ||
dependsOn setupPorts | ||
setting 'xpack.license.self_generated.type', 'trial' | ||
setting 'xpack.security.enabled', 'true' | ||
setting 'xpack.security.http.ssl.enabled', 'false' | ||
setting 'xpack.security.authc.token.enabled', 'true' | ||
setting 'xpack.security.authc.realms.file.file.order', '0' | ||
setting 'xpack.security.authc.realms.native.native.order', '1' | ||
// OpenID Connect Realm 1 configured for authorization grant flow | ||
setting 'xpack.security.authc.realms.oidc.c2id.order', '2' | ||
setting 'xpack.security.authc.realms.oidc.c2id.op.name', 'c2id-op' | ||
setting 'xpack.security.authc.realms.oidc.c2id.op.issuer', 'http://localhost:8080' | ||
setting 'xpack.security.authc.realms.oidc.c2id.op.authorization_endpoint', "http://127.0.0.1:${-> ephemeralPort}/c2id-login" | ||
setting 'xpack.security.authc.realms.oidc.c2id.op.token_endpoint', "http://127.0.0.1:${-> ephemeralPort}/c2id/token" | ||
setting 'xpack.security.authc.realms.oidc.c2id.op.userinfo_endpoint', "http://127.0.0.1:${-> ephemeralPort}/c2id/userinfo" | ||
setting 'xpack.security.authc.realms.oidc.c2id.op.jwkset_path', 'op-jwks.json' | ||
setting 'xpack.security.authc.realms.oidc.c2id.rp.redirect_uri', 'https://my.fantastic.rp/cb' | ||
setting 'xpack.security.authc.realms.oidc.c2id.rp.client_id', 'elasticsearch-rp' | ||
keystoreSetting 'xpack.security.authc.realms.oidc.c2id.rp.client_secret', 'b07efb7a1cf6ec9462afe7b6d3ab55c6c7880262aa61ac28dded292aca47c9a2' | ||
setting 'xpack.security.authc.realms.oidc.c2id.rp.response_type', 'code' | ||
setting 'xpack.security.authc.realms.oidc.c2id.claims.principal', 'sub' | ||
setting 'xpack.security.authc.realms.oidc.c2id.claims.name', 'name' | ||
setting 'xpack.security.authc.realms.oidc.c2id.claims.mail', 'email' | ||
setting 'xpack.security.authc.realms.oidc.c2id.claims.groups', 'groups' | ||
// OpenID Connect Realm 2 configured for implicit flow | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.order', '3' | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.op.name', 'c2id-implicit' | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.op.issuer', 'http://localhost:8080' | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.op.authorization_endpoint', "http://127.0.0.1:${-> ephemeralPort}/c2id-login" | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.op.token_endpoint', "http://127.0.0.1:${-> ephemeralPort}/c2id/token" | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.op.userinfo_endpoint', "http://127.0.0.1:${-> ephemeralPort}/c2id/userinfo" | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.op.jwkset_path', 'op-jwks.json' | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.rp.redirect_uri', 'https://my.fantastic.rp/cb' | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.rp.client_id', 'elasticsearch-rp' | ||
keystoreSetting 'xpack.security.authc.realms.oidc.c2id-implicit.rp.client_secret', 'b07efb7a1cf6ec9462afe7b6d3ab55c6c7880262aa61ac28dded292aca47c9a2' | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.rp.response_type', 'id_token token' | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.claims.principal', 'sub' | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.claims.name', 'name' | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.claims.mail', 'email' | ||
setting 'xpack.security.authc.realms.oidc.c2id-implicit.claims.groups', 'groups' | ||
setting 'xpack.ml.enabled', 'false' | ||
|
||
extraConfigFile 'op-jwks.json', idpFixtureProject.file("oidc/op-jwks.json") | ||
|
||
setupCommand 'setupTestAdmin', | ||
'bin/elasticsearch-users', 'useradd', "test_admin", '-p', 'x-pack-test-password', '-r', "superuser" | ||
|
||
waitCondition = { node, ant -> | ||
File tmpFile = new File(node.cwd, 'wait.success') | ||
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=${numNodes}&wait_for_status=yellow", | ||
dest: tmpFile.toString(), | ||
username: 'test_admin', | ||
password: 'x-pack-test-password', | ||
ignoreerrors: true, | ||
retries: 10) | ||
return tmpFile.exists() | ||
} | ||
} | ||
|
||
thirdPartyAudit.enabled = false |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work on hosts without docker
-Dtests.fixture.enabled=false
can be used to simulate it.I think it also needs a fix from #40297
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I raised #40585 because I wasn't sure how to do this properly and will be integrating whatever solution we come up with here to. Did you mean something like https://github.com/elastic/elasticsearch/pull/40297/files#diff-4fbfb78d054fdb66e0b02f321c8d63c5R79?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@atorok these kind of projects only contain integration tests that depend on systems running on Docker so could we have a generic way of "Don't even consider this project if Docker is not available" instead of simply disabling the
integTest
task as I did in #40585 ?