Ravi Nori has uploaded a new change for review. Change subject: engine : Webadmin won't let user login in second tab ......................................................................
engine : Webadmin won't let user login in second tab When is the user is already logged in to the webadmin portal and the user tries to login to the portal again in a second tab. The backend throws an exception that the user is already logged in. This patch lets the user login to again even if he a Http Session exists for the user. Change-Id: I80c1857ce344330bcf0588ae6c9ddc7eb5d9e4aa Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=879921 Signed-off-by: Ravi Nori <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/LoginBaseCommand.java 1 file changed, 30 insertions(+), 33 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/61/11261/1 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 1f201dd..2878752 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 @@ -23,7 +23,6 @@ import org.ovirt.engine.core.common.businessentities.LdapUser; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; -import org.ovirt.engine.core.common.interfaces.IVdcUser; import org.ovirt.engine.core.common.users.VdcUser; import org.ovirt.engine.core.dal.VdcBllMessages; import org.ovirt.engine.core.dal.dbbroker.DbFacade; @@ -156,38 +155,7 @@ } protected boolean isUserCanBeAuthenticated() { - boolean authenticated = false; - IVdcUser vdcUser = SessionDataContainer.getInstance().getUser(false); - if (vdcUser == null) { - boolean domainFound = false; - List<String> vdcDomains = LdapBrokerUtils.getDomainsList(); - for (String domain : vdcDomains) { - if (StringUtils.equals(domain.toLowerCase(), getDomain().toLowerCase())) { - domainFound = true; - break; - } - } - if (!domainFound) { - addCanDoActionMessage(VdcBllMessages.USER_CANNOT_LOGIN_DOMAIN_NOT_SUPPORTED); - return false; - } - - UserAuthenticationResult result = authenticateUser(); - // If no result object is returned from authentication - create a result object with general authentication - // error - if (result == null) { - result = new UserAuthenticationResult(VdcBllMessages.USER_FAILED_TO_AUTHENTICATE); - } - ldapUser = result.getUser(); - authenticated = result.isSuccessful(); - - if ((!authenticated || ldapUser == null)) { - HandleAuthenticationError(result.getErrorMessages()); - authenticated = false; - } - } else { - addCanDoActionMessage(VdcBllMessages.USER_IS_ALREADY_LOGGED_IN); - } + boolean authenticated = authenticateWithLdap(); if (authenticated) { /* * Check login permissions @@ -212,6 +180,35 @@ return authenticated; } + private boolean authenticateWithLdap() { + boolean domainFound = false; + List<String> vdcDomains = LdapBrokerUtils.getDomainsList(); + for (String domain : vdcDomains) { + if (StringUtils.equals(domain.toLowerCase(), getDomain().toLowerCase())) { + domainFound = true; + break; + } + } + if (!domainFound) { + addCanDoActionMessage(VdcBllMessages.USER_CANNOT_LOGIN_DOMAIN_NOT_SUPPORTED); + return false; + } + + UserAuthenticationResult result = authenticateUser(); + // If no result object is returned from authentication - create a result object with general authentication + // error + if (result == null) { + result = new UserAuthenticationResult(VdcBllMessages.USER_FAILED_TO_AUTHENTICATE); + } + ldapUser = result.getUser(); + boolean authenticated = result.isSuccessful(); + if ((!authenticated || ldapUser == null)) { + HandleAuthenticationError(result.getErrorMessages()); + authenticated = false; + } + return authenticated; + } + @Override protected boolean isUserAuthorizedToRunAction() { if (log.isDebugEnabled()) { -- To view, visit http://gerrit.ovirt.org/11261 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I80c1857ce344330bcf0588ae6c9ddc7eb5d9e4aa Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ravi Nori <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
