|
7 | 7 |
|
8 | 8 | import org.elasticsearch.ElasticsearchException;
|
9 | 9 | import org.elasticsearch.common.CharArrays;
|
| 10 | +import org.elasticsearch.common.SuppressForbidden; |
10 | 11 | import org.elasticsearch.common.hash.MessageDigests;
|
11 | 12 | import org.elasticsearch.common.settings.SecureString;
|
12 | 13 |
|
@@ -565,12 +566,25 @@ private static boolean verifyBcryptHash(SecureString text, char[] hash) {
|
565 | 566 | * combinations that can be used for password hashing. The identifiers can be used to get
|
566 | 567 | * an instance of the appropriate {@link Hasher} by using {@link #resolve(String) resolve()}
|
567 | 568 | */
|
| 569 | + @SuppressForbidden(reason = "This is the only allowed way to get available values") |
568 | 570 | public static List<String> getAvailableAlgoStoredHash() {
|
569 | 571 | return Arrays.stream(Hasher.values()).map(Hasher::name).map(name -> name.toLowerCase(Locale.ROOT))
|
570 | 572 | .filter(name -> (name.startsWith("pbkdf2") || name.startsWith("bcrypt")))
|
571 | 573 | .collect(Collectors.toList());
|
572 | 574 | }
|
573 | 575 |
|
| 576 | + /** |
| 577 | + * Returns a list of lower case String identifiers for the Hashing algorithm and parameter |
| 578 | + * combinations that can be used for password hashing in the cache. The identifiers can be used to get |
| 579 | + * an instance of the appropriate {@link Hasher} by using {@link #resolve(String) resolve()} |
| 580 | + */ |
| 581 | + @SuppressForbidden(reason = "This is the only allowed way to get available values") |
| 582 | + public static List<String> getAvailableAlgoCacheHash() { |
| 583 | + return Arrays.stream(Hasher.values()).map(Hasher::name).map(name -> name.toLowerCase(Locale.ROOT)) |
| 584 | + .filter(name -> (name.equals("sha256") == false)) |
| 585 | + .collect(Collectors.toList()); |
| 586 | + } |
| 587 | + |
574 | 588 | public abstract char[] hash(SecureString data);
|
575 | 589 |
|
576 | 590 | public abstract boolean verify(SecureString data, char[] hash);
|
|
0 commit comments