From a4bee5006ebefa00e3f39cc99c2975b014623874 Mon Sep 17 00:00:00 2001 From: ulrich Date: Tue, 15 Jun 2021 15:34:35 +0000 Subject: [PATCH] Kommentare ergaenzt --- src/de/uhilger/httpserver/oauth/BearerLoginHandler.java | 31 ++++++++++++++----------------- 1 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/de/uhilger/httpserver/oauth/BearerLoginHandler.java b/src/de/uhilger/httpserver/oauth/BearerLoginHandler.java index a563ece..e153ae5 100644 --- a/src/de/uhilger/httpserver/oauth/BearerLoginHandler.java +++ b/src/de/uhilger/httpserver/oauth/BearerLoginHandler.java @@ -23,10 +23,9 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import de.uhilger.httpserver.auth.realm.User; -import de.uhilger.httpserver.base.handler.HttpHelper; -import de.uhilger.httpserver.base.handler.HttpResponder; +import de.uhilger.httpserver.base.HttpHelper; +import de.uhilger.httpserver.base.HttpResponder; import java.io.IOException; -import java.util.logging.Level; import java.util.logging.Logger; /** @@ -78,6 +77,12 @@ "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA" } */ + /** + * Login-Anfragen ausfuehren + * + * @param exchange das Objekt mit Informationen zu HTTP-Anfrage und -Antwort + * @throws IOException + */ @Override public void handle(HttpExchange exchange) throws IOException { HttpContext context = exchange.getHttpContext(); @@ -87,28 +92,20 @@ User user = getUser(exchange); LoginResponse response = auth.login(user.getName(), user.getPassword()); handleLoginResponse(exchange, response); - /* - if(response != null) { - // hier erfolg melden - // 200 OK - setLoginHeader(exchange); - HttpResponder r = new HttpResponder(); - r.antwortSenden(exchange, 200, response.toJson()); - } else { - HttpResponder r = new HttpResponder(); - r.antwortSenden(exchange, 406, "Login failed."); - } - */ } else { HttpResponder r = new HttpResponder(); r.antwortSenden(exchange, 500, "No suitable authenticator."); } } + /** + * Die Antwort des Authenticators auf eine Login-Anfrage verarbeiten + * @param exchange das Objekt mit Informationen zu HTTP-Anfrage und -Antwort + * @param response die Antwort des Autehnticators + * @throws IOException + */ protected void handleLoginResponse(HttpExchange exchange, LoginResponse response) throws IOException { if(response != null) { - // hier erfolg melden - // 200 OK setLoginHeader(exchange); HttpResponder r = new HttpResponder(); r.antwortSenden(exchange, 200, response.toJson()); -- Gitblit v1.9.3