Eli Mesika has uploaded a new change for review.

Change subject: core: log login failure to webadmin userportal...
......................................................................

core: log login failure to webadmin userportal...

Log login failure to webadmin userportal from UI/API

This patch adds login of authentication failures such that failed
attempts to login to the application from user portal or web admin will
be recorded as well.

Change-Id: I3ebefcad91d7e37d2e1bb2adf1708b950283b92e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1066103
Signed-off-by: Eli Mesika <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginAdminUserCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginBaseCommand.java
2 files changed, 17 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/38/25638/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginAdminUserCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginAdminUserCommand.java
index b18ef16..7736a34 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginAdminUserCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginAdminUserCommand.java
@@ -24,6 +24,9 @@
                 autheticated = attachUserToSession();
             }
         }
+        if (! autheticated) {
+            logAutheticationFailure();
+        }
         return autheticated;
     }
 }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginBaseCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginBaseCommand.java
index b74c850..713c2ff 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginBaseCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginBaseCommand.java
@@ -22,6 +22,8 @@
 import org.ovirt.engine.core.common.businessentities.DbUser;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;
 import org.ovirt.engine.core.utils.log.Log;
 import org.ovirt.engine.core.utils.log.LogFactory;
 import org.ovirt.engine.core.utils.threadpool.ThreadPoolUtil;
@@ -60,10 +62,13 @@
 
         setSucceeded(true);
     }
-
-    @Override
+   @Override
     protected boolean canDoAction() {
-        return isUserCanBeAuthenticated() && attachUserToSession();
+        boolean result = isUserCanBeAuthenticated() && attachUserToSession();
+        if (! result) {
+            logAutheticationFailure();
+        }
+        return result;
     }
 
     protected boolean attachUserToSession() {
@@ -221,4 +226,10 @@
             }
         });
     }
+
+    protected void logAutheticationFailure() {
+        AuditLogableBase logable = new AuditLogableBase();
+        logable.setUserName(getParameters().getLoginName());
+        AuditLogDirector.log(logable, AuditLogType.USER_VDC_LOGIN_FAILED);
+    }
 }


-- 
To view, visit http://gerrit.ovirt.org/25638
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ebefcad91d7e37d2e1bb2adf1708b950283b92e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Eli Mesika <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to