working on oidc auth

This commit is contained in:
2022-04-14 11:58:21 +02:00
parent b2d9a115b9
commit b251e4e4cb
13 changed files with 371 additions and 19 deletions

View File

@@ -1,5 +1,15 @@
package de.srsoftware.widerhall;
import de.srsoftware.widerhall.mail.Forwarder;
import de.srsoftware.widerhall.mail.ImapClient;
import de.srsoftware.widerhall.mail.MessageHandler;
import de.srsoftware.widerhall.web.Index;
import de.srsoftware.widerhall.web.Login;
import de.srsoftware.widerhall.web.Rest;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@@ -7,17 +17,35 @@ import org.json.simple.parser.ParseException;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import static de.srsoftware.widerhall.Constants.*;
public class Application {
public static void main(String[] args) throws IOException, ParseException {
var parser = new JSONParser();
var config = Files.readString(new File("/tmp/config.json").toPath());
JSONObject json = (JSONObject) parser.parse(config);
public static void main(String[] args) throws Exception {
var config = Configuration.setFile(new File("/tmp/config.json"));
//startMailSystem(json);
startWebserver(config);
}
private static void startWebserver(Configuration config) throws Exception {
var server = new Server();
var connector = new ServerConnector(server);
connector.setPort(config.serverPort());
server.setConnectors(new Connector[]{connector});
ServletContextHandler context = new ServletContextHandler(server, "/");
context.addServlet(Rest.class,"/api");
context.addServlet(Login.class,"/login");
context.addServlet(Index.class,"/");
server.start();
}
private static void startMailSystem(JSONObject json) {
MessageHandler forward = new Forwarder(json);
new ImapClient(json)
.addListener(forward)
.start();
new ImapClient(json)
.addListener(forward)
.start();
}
}