From a3e9067ee6553740ecd52eec96213b4da399a4dc Mon Sep 17 00:00:00 2001 From: chilimannen Date: Fri, 20 Jan 2017 22:05:03 +0100 Subject: [PATCH] Fix compilation errors. --- core/main/com/codingchili/core/security/HashHelper.java | 2 +- core/test/com/codingchili/core/security/HashHelperTest.java | 2 +- .../main/com/codingchili/authentication/model/AccountDB.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/main/com/codingchili/core/security/HashHelper.java b/core/main/com/codingchili/core/security/HashHelper.java index b1137dfc..9ca58f94 100644 --- a/core/main/com/codingchili/core/security/HashHelper.java +++ b/core/main/com/codingchili/core/security/HashHelper.java @@ -72,7 +72,7 @@ public void hash(Future future, String password, String salt) { * * @return A generated salt of 512 bits. */ - public String generateSalt() { + public String salt() { byte[] salt = new byte[SALT_BYTES]; new SecureRandom().nextBytes(salt); return Base64.getEncoder().encodeToString(salt); diff --git a/core/test/com/codingchili/core/security/HashHelperTest.java b/core/test/com/codingchili/core/security/HashHelperTest.java index 800c0e40..96805de1 100644 --- a/core/test/com/codingchili/core/security/HashHelperTest.java +++ b/core/test/com/codingchili/core/security/HashHelperTest.java @@ -43,7 +43,7 @@ public void generateUniqueSaltTest() { HashMap salts = new HashMap<>(); for (int i = 0; i < 1000; i++) { - String salt = HashHelper.generateSalt(); + String salt = new HashHelper(vertx).salt(); Assert.assertFalse(salts.containsKey(salt)); salts.put(salt, true); diff --git a/services/authentication/main/com/codingchili/authentication/model/AccountDB.java b/services/authentication/main/com/codingchili/authentication/model/AccountDB.java index a27dc4dd..faf58a60 100644 --- a/services/authentication/main/com/codingchili/authentication/model/AccountDB.java +++ b/services/authentication/main/com/codingchili/authentication/model/AccountDB.java @@ -47,7 +47,7 @@ public void authenticate(Future future, Account account) { public void register(Future future, Account account) { Future hashing = Future.future(); AccountMapping mapping = new AccountMapping(account) - .setSalt(hasher.generateSalt()); + .setSalt(hasher.salt()); hashing.setHandler(hash -> { mapping.setHash(hash.result());