working on tests for UserService
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -50,6 +50,11 @@ public class FileStore implements AuthorizationService, ClientService, SessionSe
|
||||
Files.writeString(storageFile, "{}");
|
||||
}
|
||||
json = new JSONObject(Files.readString(storageFile));
|
||||
json.put(AUTHORIZATIONS, new JSONObject());
|
||||
json.put(CLIENTS, new JSONObject());
|
||||
json.put(MAILCONFIG, new JSONObject());
|
||||
json.put(SESSIONS, new JSONObject());
|
||||
json.put(USERS, new JSONObject());
|
||||
auth = null; // lazy init!
|
||||
}
|
||||
|
||||
@@ -137,11 +142,8 @@ public class FileStore implements AuthorizationService, ClientService, SessionSe
|
||||
|
||||
@Override
|
||||
public FileStore init(User defaultUser) {
|
||||
if (!json.has(AUTHORIZATIONS)) json.put(AUTHORIZATIONS, new JSONObject());
|
||||
if (!json.has(CLIENTS)) json.put(CLIENTS, new JSONObject());
|
||||
if (!json.has(MAILCONFIG)) json.put(MAILCONFIG, new JSONObject());
|
||||
if (!json.has(SESSIONS)) json.put(SESSIONS, new JSONObject());
|
||||
if (!json.has(USERS)) save(defaultUser);
|
||||
var users = json.getJSONObject(USERS);
|
||||
if (users.length() < 1) save(defaultUser);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class UuidHasher implements PasswordHasher<String> {
|
||||
|
||||
@Override
|
||||
public String salt(String hashedPassword) {
|
||||
return hashedPassword.split("@")[1];
|
||||
return hashedPassword.split("@", 2)[1];
|
||||
}
|
||||
|
||||
public static String hex(byte[] bytes) {
|
||||
|
||||
Reference in New Issue
Block a user