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/BearerAuthenticator.java |    4 +++-
 1 files changed, 3 insertions(+), 1 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;
     }
   }

--
Gitblit v1.9.3