Updated Branches: refs/heads/master 4f53eb11f -> 519ca619d
Encode password using UserAuthenticator Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/519ca619 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/519ca619 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/519ca619 Branch: refs/heads/master Commit: 519ca619dfbedcdb99d91f8e85935610d88495f3 Parents: 4f53eb1 Author: Kishan Kavala <[email protected]> Authored: Fri Feb 1 12:23:15 2013 +0530 Committer: Kishan Kavala <[email protected]> Committed: Fri Feb 1 12:23:15 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/user/AccountManagerImpl.java | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/519ca619/server/src/com/cloud/user/AccountManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index c5a8c75..23cd5b9 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -1756,7 +1756,19 @@ public class AccountManagerImpl implements AccountManager, Manager { s_logger.debug("Creating user: " + userName + ", accountId: " + accountId + " timezone:" + timezone); } - UserVO user = _userDao.persist(new UserVO(accountId, userName, password, firstName, lastName, email, timezone, UUID.randomUUID().toString(), _regionMgr.getId())); + String encodedPassword = null; + for (Enumeration<UserAuthenticator> en = _userAuthenticators.enumeration(); en.hasMoreElements();) { + UserAuthenticator authenticator = en.nextElement(); + encodedPassword = authenticator.encode(password); + if (encodedPassword != null) { + break; + } + } + if (encodedPassword == null) { + throw new CloudRuntimeException("Failed to encode password"); + } + + UserVO user = _userDao.persist(new UserVO(accountId, userName, encodedPassword, firstName, lastName, email, timezone, UUID.randomUUID().toString(), _regionMgr.getId())); return user; }
