|
8 | 8 | import org.elasticsearch.ElasticsearchSecurityException;
|
9 | 9 | import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
10 | 10 | import org.elasticsearch.common.settings.SecureString;
|
| 11 | +import org.elasticsearch.common.settings.Settings; |
11 | 12 | import org.elasticsearch.test.NativeRealmIntegTestCase;
|
12 | 13 | import org.elasticsearch.xpack.core.security.action.user.ChangePasswordResponse;
|
| 14 | +import org.elasticsearch.xpack.core.security.authc.support.Hasher; |
13 | 15 | import org.elasticsearch.xpack.core.security.client.SecurityClient;
|
14 | 16 | import org.elasticsearch.xpack.core.security.user.BeatsSystemUser;
|
15 | 17 | import org.elasticsearch.xpack.core.security.user.ElasticUser;
|
16 | 18 | import org.elasticsearch.xpack.core.security.user.KibanaUser;
|
17 | 19 | import org.elasticsearch.xpack.core.security.user.LogstashSystemUser;
|
| 20 | +import org.junit.BeforeClass; |
18 | 21 |
|
19 | 22 | import java.util.Arrays;
|
20 | 23 |
|
|
29 | 32 | */
|
30 | 33 | public class ReservedRealmIntegTests extends NativeRealmIntegTestCase {
|
31 | 34 |
|
| 35 | + private static Hasher hasher; |
| 36 | + |
| 37 | + @BeforeClass |
| 38 | + public static void setHasher() { |
| 39 | + hasher = getFastStoredHashAlgoForTests(); |
| 40 | + } |
| 41 | + |
| 42 | + @Override |
| 43 | + public Settings nodeSettings(int nodeOrdinal) { |
| 44 | + Settings settings = Settings.builder() |
| 45 | + .put(super.nodeSettings(nodeOrdinal)) |
| 46 | + .put("xpack.security.authc.password_hashing.algorithm", hasher.name()) |
| 47 | + .build(); |
| 48 | + return settings; |
| 49 | + } |
| 50 | + |
32 | 51 | public void testAuthenticate() {
|
33 | 52 | for (String username : Arrays.asList(ElasticUser.NAME, KibanaUser.NAME, LogstashSystemUser.NAME, BeatsSystemUser.NAME)) {
|
34 | 53 | ClusterHealthResponse response = client()
|
@@ -76,7 +95,7 @@ public void testChangingPassword() {
|
76 | 95 | }
|
77 | 96 |
|
78 | 97 | ChangePasswordResponse response = securityClient()
|
79 |
| - .prepareChangePassword(username, Arrays.copyOf(newPassword, newPassword.length), getFastStoredHashAlgoForTests()) |
| 98 | + .prepareChangePassword(username, Arrays.copyOf(newPassword, newPassword.length), hasher) |
80 | 99 | .get();
|
81 | 100 | assertThat(response, notNullValue());
|
82 | 101 |
|
|
0 commit comments