-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Make order setting mandatory for Realm config #51195
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
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
65cf24c
WIP: making realm order config mandatory
ywangd d186b0a
Support explicit order parameter for RealmConfig
ywangd 82e08d2
Fix security plugin tests for required order param
ywangd 71bfb3e
Fix more tests for required order param
ywangd 5370163
Fix ci/2 failures
ywangd 1132f5f
Merge branch 'master' into issue-37614-realm-order
elasticmachine 7fa20a3
Fix more require order parameter failure
ywangd 3d724e8
Enforce no same order for realms.
ywangd adca1bf
Fix duplicate order for tests
ywangd 0f60b22
Add realm order to breaking change doc
ywangd 3cb7a83
Start updating docs for realm order
ywangd 22399ce
Add missing order config in docs
ywangd 0edef24
Merge branch 'master' into issue-37614-realm-order
elasticmachine b439a49
Update docs/reference/migration/migrate_8_0/security.asciidoc
ywangd 9548e2f
Merge branch 'master' into issue-37614-realm-order
elasticmachine a74482e
Update for docs feedback
ywangd e0aa65b
Update doc to address feedback
ywangd 994c0af
More wording changes based on feedback
ywangd da8e7e3
Address feedback for docs
ywangd 7fbf061
Address feedback to revert accident change
ywangd 472b2d6
Merge remote-tracking branch 'origin/master' into issue-37614-realm-o…
ywangd 64d0292
Update based on discussion with Tim.
ywangd aad6d19
Address feedback for consistent err msg
ywangd 84cb684
Update x-pack/docs/en/security/authentication/custom-realm.asciidoc
ywangd 4c61828
Update x-pack/docs/en/security/authentication/realm-chains.asciidoc
ywangd c264e31
Address feedback for docs
ywangd 43fffa3
Merge remote-tracking branch 'origin/master' into issue-37614-realm-o…
ywangd 0614cbc
Update docs/reference/migration/migrate_8_0/security.asciidoc
ywangd fe13c71
Update x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/s…
ywangd ad7a1b5
Merge remote-tracking branch 'origin/master' into issue-37614-realm-o…
ywangd 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
51 changes: 51 additions & 0 deletions
51
...ugin/core/src/test/java/org/elasticsearch/xpack/core/security/authc/RealmConfigTests.java
This file contains hidden or 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,51 @@ | ||
| /* | ||
| * | ||
| * * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * * or more contributor license agreements. Licensed under the Elastic License; | ||
| * * you may not use this file except in compliance with the Elastic License. | ||
| * | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.core.security.authc; | ||
|
|
||
| import org.elasticsearch.common.settings.Settings; | ||
| import org.elasticsearch.common.util.concurrent.ThreadContext; | ||
| import org.elasticsearch.env.Environment; | ||
| import org.elasticsearch.test.ESTestCase; | ||
| import org.junit.Before; | ||
| import org.mockito.Mockito; | ||
|
|
||
| import static org.hamcrest.Matchers.containsString; | ||
|
|
||
| public class RealmConfigTests extends ESTestCase { | ||
|
|
||
| private RealmConfig.RealmIdentifier realmIdentifier; | ||
| private Settings globalSettings; | ||
| private Environment environment; | ||
| private ThreadContext threadContext; | ||
|
|
||
| @Before | ||
| public void setUp() throws Exception { | ||
| realmIdentifier = new RealmConfig.RealmIdentifier(randomAlphaOfLengthBetween(4, 12), randomAlphaOfLengthBetween(4,12)); | ||
| environment = Mockito.mock(Environment.class); | ||
| globalSettings = Settings.builder().put("path.home", createTempDir()).build(); | ||
| threadContext = new ThreadContext(globalSettings); | ||
| super.setUp(); | ||
| } | ||
|
|
||
| public void testWillPassWhenOrderSettingIsConfigured() { | ||
| Settings settings = Settings.builder() | ||
| .put(globalSettings) | ||
| .put(RealmSettings.realmSettingPrefix(realmIdentifier) + "order", 0) | ||
| .build(); | ||
|
|
||
| RealmConfig realmConfig = new RealmConfig(realmIdentifier, settings, environment, threadContext); | ||
| assertEquals(0, realmConfig.order); | ||
| } | ||
|
|
||
| public void testWillFailWhenOrderSettingIsMissing() { | ||
| Settings settings = Settings.builder().put(globalSettings).build(); | ||
| var e = expectThrows(IllegalArgumentException.class, () -> new RealmConfig(realmIdentifier, settings, environment, threadContext)); | ||
| assertThat(e.getMessage(), containsString("'order' is a mandatory parameter for realm config")); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.