conveniance modification: added registry and getters for modules to BaseHandler

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-08-17 23:31:06 +02:00
parent ecb1ddac0f
commit a50a451b95
21 changed files with 260 additions and 198 deletions

View File

@@ -69,7 +69,6 @@ public class UserModule extends BaseHandler implements UserService {
private static final System.Logger LOG = System.getLogger("User");
private final UserDb users;
private final LoginServiceDb logins;
private final ModuleRegistry registry;
private final HashMap<String, State> stateMap = new HashMap<>(); // map from state to OIDC provider name
private final HashMap<String,String> tokenMap = new HashMap<>();
@@ -82,11 +81,11 @@ public class UserModule extends BaseHandler implements UserService {
}
public UserModule(ModuleRegistry registry, Configuration config) throws UmbrellaException {
super(registry);
var dbFile = config.get(CONFIG_DATABASE).orElseThrow(() -> missingConfigException(CONFIG_DATABASE));
// may be splitted in separate db files later
logins = new SqliteDB(connect(dbFile));
users = new SqliteDB(connect(dbFile));
this.registry = registry.add(this);
}
private boolean deleteOIDC(HttpExchange ex, UmbrellaUser user, Path path) throws IOException {
@@ -504,7 +503,7 @@ public class UserModule extends BaseHandler implements UserService {
var fills = Map.of("url",url);
var message = new Message(user,subject,content,fills,null);
var envelope = new Envelope(message,user);
registry.postBox().send(envelope);
postBox().send(envelope);
} catch (UmbrellaException e){
return send(ex,e);
}