mirror of https://github.com/apache/cloudstack.git
bug 11303: passing the request params to the authenticators, callingh authenticators in a configurable chain
This commit is contained in:
parent
a60d8cea86
commit
4f9cbdaadb
|
|
@ -52,7 +52,7 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator {
|
|||
private UserAccountDao _userAccountDao;
|
||||
|
||||
@Override
|
||||
public boolean authenticate(String username, String password, Long domainId) {
|
||||
public boolean authenticate(String username, String password, Long domainId, Map<String, Object[]> requestParameters ) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Retrieving user: " + username);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class MD5UserAuthenticator extends DefaultUserAuthenticator {
|
|||
private UserAccountDao _userAccountDao;
|
||||
|
||||
@Override
|
||||
public boolean authenticate(String username, String password, Long domainId) {
|
||||
public boolean authenticate(String username, String password, Long domainId, Map<String, Object[]> requestParameters ) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Retrieving user: " + username);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package com.cloud.server.auth;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
/**
|
||||
|
|
@ -36,5 +38,5 @@ public interface UserAuthenticator extends Adapter {
|
|||
* @param domainId
|
||||
* @return true if the user has been successfully authenticated, false otherwise
|
||||
*/
|
||||
public boolean authenticate(String username, String password, Long domainId);
|
||||
public boolean authenticate(String username, String password, Long domainId, Map<String, Object[]> requestParameters);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1549,7 +1549,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||
public UserAccount authenticateUser(String username, String password, Long domainId, Map<String, Object[]> requestParameters) {
|
||||
UserAccount user = null;
|
||||
if (password != null) {
|
||||
user = getUserAccount(username, password, domainId);
|
||||
user = getUserAccount(username, password, domainId, requestParameters);
|
||||
} else {
|
||||
String key = _configDao.getValue("security.singlesignon.key");
|
||||
if (key == null) {
|
||||
|
|
@ -1657,16 +1657,15 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||
}
|
||||
}
|
||||
|
||||
private UserAccount getUserAccount(String username, String password, Long domainId) {
|
||||
private UserAccount getUserAccount(String username, String password, Long domainId, Map<String, Object[]> requestParameters) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Attempting to log in user: " + username + " in domain " + domainId);
|
||||
}
|
||||
|
||||
boolean authenticated = false;
|
||||
// We only use the first adapter even if multiple have been configured
|
||||
for (Enumeration<UserAuthenticator> en = _userAuthenticators.enumeration(); en.hasMoreElements();){
|
||||
UserAuthenticator authenticator = en.nextElement();
|
||||
if (authenticator.authenticate(username, password, domainId)){
|
||||
if (authenticator.authenticate(username, password, domainId, requestParameters)){
|
||||
authenticated = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue