From 8c1928946cb3b4f2d9ead70c7362ce1dbe045fa4 Mon Sep 17 00:00:00 2001 From: ulrich Date: Mon, 05 Jul 2021 10:53:23 +0000 Subject: [PATCH] Log-Eintraege fuer log in --- src/de/uhilger/httpserver/oauth/BearerLoginHandler.java | 2 +- src/de/uhilger/httpserver/oauth/BearerAuthenticator.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/de/uhilger/httpserver/oauth/BearerAuthenticator.java b/src/de/uhilger/httpserver/oauth/BearerAuthenticator.java index 073f422..ce231d9 100644 --- a/src/de/uhilger/httpserver/oauth/BearerAuthenticator.java +++ b/src/de/uhilger/httpserver/oauth/BearerAuthenticator.java @@ -132,8 +132,9 @@ * @param password das Kennwort des Benutzers * @return Token oder null, wenn die Anmeldung misslang */ - public LoginResponse login(String userId, String password) { + public LoginResponse login(HttpExchange e, String userId, String password) { if (realm.isValid(userId, password)) { + logger.info(userId + " logged in from IP." + e.getRemoteAddress()); LoginResponse r = new LoginResponse(); String token = createToken(userId, expireSeconds); r.setToken(token); @@ -141,6 +142,7 @@ r.setExpiresIn(expireSeconds); return r; } else { + logger.info("Invalid log in attempt for " + userId + " from IP " + e.getRemoteAddress()); return null; } } diff --git a/src/de/uhilger/httpserver/oauth/BearerLoginHandler.java b/src/de/uhilger/httpserver/oauth/BearerLoginHandler.java index e153ae5..e833045 100644 --- a/src/de/uhilger/httpserver/oauth/BearerLoginHandler.java +++ b/src/de/uhilger/httpserver/oauth/BearerLoginHandler.java @@ -90,7 +90,7 @@ if (o instanceof BearerAuthenticator) { BearerAuthenticator auth = (BearerAuthenticator) o; User user = getUser(exchange); - LoginResponse response = auth.login(user.getName(), user.getPassword()); + LoginResponse response = auth.login(exchange, user.getName(), user.getPassword()); handleLoginResponse(exchange, response); } else { HttpResponder r = new HttpResponder(); -- Gitblit v1.9.3