Browse Source

minor code improvements

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
sqlite
Stephan Richter 2 months ago
parent
commit
0b2ddd99c0
  1. 20
      de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java

20
de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java

@ -51,22 +51,22 @@ public class Application { @@ -51,22 +51,22 @@ public class Application {
private static ConnectionProvider connectionProvider = new ConnectionProvider();
public static void main(String[] args) throws Exception {
var argMap = map(args);
Optional<Path> basePath = argMap.get(BASE_PATH) instanceof Path p ? Optional.of(p) : empty();
var configFile = (argMap.get(CONFIG_PATH) instanceof Path p ? p : configDir(APP_NAME).resolve("config.json")).toFile();
var config = new Configuration(configFile);
var passHasher = new UuidHasher();
var firstHash = passHasher.hash(FIRST_USER_PASS, FIRST_UUID);
var firstUser = new User(FIRST_USER, firstHash, FIRST_USER, "%s@internal".formatted(FIRST_USER), FIRST_UUID).add(MANAGE_CLIENTS, MANAGE_PERMISSIONS, MANAGE_SMTP, MANAGE_USERS);
var argMap = map(args);
Optional<Path> basePath = argMap.get(BASE_PATH) instanceof Path p ? Optional.of(p) : empty();
var configDir = configDir(APP_NAME);
var defaultFile = configDir.resolve("data.json");
var configFile = (argMap.get(CONFIG_PATH) instanceof Path p ? p : configDir.resolve("config.json")).toFile();
var config = new Configuration(configFile);
var passHasher = new UuidHasher();
var firstHash = passHasher.hash(FIRST_USER_PASS, FIRST_UUID);
var firstUser = new User(FIRST_USER, firstHash, FIRST_USER, "%s@internal".formatted(FIRST_USER), FIRST_UUID).add(MANAGE_CLIENTS, MANAGE_PERMISSIONS, MANAGE_SMTP, MANAGE_USERS);
FileStoreProvider fileStoreProvider = new FileStoreProvider(passHasher);
var defaultConfigDir = configDir(APP_NAME);
var defaultFile = defaultConfigDir.resolve("data.json");
var userService = setupUserService(config, defaultFile, fileStoreProvider).init(firstUser);
var sessionService = setupSessionService(config, defaultFile, fileStoreProvider);
var mailConfig = setupMailConfig(config, defaultFile, fileStoreProvider);
var keyStore = setupKeyStore(config, defaultConfigDir);
var keyStore = setupKeyStore(config, configDir);
KeyManager keyManager = new RotatingKeyManager(keyStore);
var authService = setupAuthService(config, defaultFile, fileStoreProvider);
var clientService = setupClientService(config, defaultFile, fileStoreProvider);

Loading…
Cancel
Save