use of suite.http.HttpSessionController.Authenticator in project suite by stupidsing.
the class ServerMain method runHttpServer.
private void runHttpServer() {
Authenticator authenticator = (username, password) -> Constants.secrets().prove(Suite.substitute("auth .0 .1", new Str(username), new Str(password)));
HttpHandler handler0 = request -> HttpResponse.of(To.outlet(//
"" + //
"<html>" + "<br/>method = " + //
request.method + "<br/>server = " + //
request.server + "<br/>path = " + //
request.path + "<br/>attrs = " + //
HttpHeaderUtil.getAttrs(request.query) + "<br/>headers = " + //
request.headers + "</html>"));
HttpHandler handler1 = HttpHandler.ofDispatch(//
IMap.<String, HttpHandler>empty().put("path", //
HttpHandler.ofPath(Constants.tmp)).put("site", HttpHandler.ofSession(authenticator, handler0)));
new HttpServer().run(handler1);
}
Aggregations