Skip to content

Commit 4f9cbda

Browse files
author
Abhinandan Prateek
committed
bug 11303: passing the request params to the authenticators, callingh authenticators in a configurable chain
1 parent a60d8ce commit 4f9cbda

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎server/src/com/cloud/server/auth/LDAPUserAuthenticator.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator {
5252
private UserAccountDao _userAccountDao;
5353

5454
@Override
55-
public boolean authenticate(String username, String password, Long domainId) {
55+
public boolean authenticate(String username, String password, Long domainId, Map<String, Object[]> requestParameters ) {
5656
if (s_logger.isDebugEnabled()) {
5757
s_logger.debug("Retrieving user: " + username);
5858
}

‎server/src/com/cloud/server/auth/MD5UserAuthenticator.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class MD5UserAuthenticator extends DefaultUserAuthenticator {
4747
private UserAccountDao _userAccountDao;
4848

4949
@Override
50-
public boolean authenticate(String username, String password, Long domainId) {
50+
public boolean authenticate(String username, String password, Long domainId, Map<String, Object[]> requestParameters ) {
5151
if (s_logger.isDebugEnabled()) {
5252
s_logger.debug("Retrieving user: " + username);
5353
}

‎server/src/com/cloud/server/auth/UserAuthenticator.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
package com.cloud.server.auth;
2020

21+
import java.util.Map;
22+
2123
import com.cloud.utils.component.Adapter;
2224

2325
/**
@@ -36,5 +38,5 @@ public interface UserAuthenticator extends Adapter {
3638
* @param domainId
3739
* @return true if the user has been successfully authenticated, false otherwise
3840
*/
39-
public boolean authenticate(String username, String password, Long domainId);
41+
public boolean authenticate(String username, String password, Long domainId, Map<String, Object[]> requestParameters);
4042
}

‎server/src/com/cloud/user/AccountManagerImpl.java‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ public UserAccount getUserAccount(String username, Long domainId) {
15491549
public UserAccount authenticateUser(String username, String password, Long domainId, Map<String, Object[]> requestParameters) {
15501550
UserAccount user = null;
15511551
if (password != null) {
1552-
user = getUserAccount(username, password, domainId);
1552+
user = getUserAccount(username, password, domainId, requestParameters);
15531553
} else {
15541554
String key = _configDao.getValue("security.singlesignon.key");
15551555
if (key == null) {
@@ -1657,16 +1657,15 @@ public UserAccount authenticateUser(String username, String password, Long domai
16571657
}
16581658
}
16591659

1660-
private UserAccount getUserAccount(String username, String password, Long domainId) {
1660+
private UserAccount getUserAccount(String username, String password, Long domainId, Map<String, Object[]> requestParameters) {
16611661
if (s_logger.isDebugEnabled()) {
16621662
s_logger.debug("Attempting to log in user: " + username + " in domain " + domainId);
16631663
}
16641664

16651665
boolean authenticated = false;
1666-
// We only use the first adapter even if multiple have been configured
16671666
for (Enumeration<UserAuthenticator> en = _userAuthenticators.enumeration(); en.hasMoreElements();){
16681667
UserAuthenticator authenticator = en.nextElement();
1669-
if (authenticator.authenticate(username, password, domainId)){
1668+
if (authenticator.authenticate(username, password, domainId, requestParameters)){
16701669
authenticated = true;
16711670
break;
16721671
}

0 commit comments

Comments
 (0)