You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2017/06/09 09:18:27 UTC
[07/11] marmotta git commit: MARMOTTA-534: fixed issue of not loading
password hash from plain password
MARMOTTA-534: fixed issue of not loading password hash from plain password
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/2d6a60f2
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/2d6a60f2
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/2d6a60f2
Branch: refs/heads/develop
Commit: 2d6a60f28481c8d0000f155bbf40b04bfef5b534
Parents: 0f12ac8
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 10:29:04 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 10:29:04 2017 +0200
----------------------------------------------------------------------
.../user/services/AccountServiceImpl.java | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/2d6a60f2/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AccountServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AccountServiceImpl.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AccountServiceImpl.java
index 6dddd63..6cb09b5 100644
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AccountServiceImpl.java
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AccountServiceImpl.java
@@ -48,19 +48,19 @@ import java.util.concurrent.ConcurrentMap;
public class AccountServiceImpl implements AccountService {
@Inject
- private Logger log;
+ private Logger log;
@Inject
private ConfigurationService configurationService;
@Inject
- private UserService userService;
+ private UserService userService;
@Inject
@MarmottaCache("user-cache")
private ConcurrentMap userCache;
- private PasswordHash hashAlgo;
+ private PasswordHash hashAlgo;
public AccountServiceImpl() {
@@ -104,7 +104,7 @@ public class AccountServiceImpl implements AccountService {
@Override
public List<UserAccount> listAccounts() {
- Set<String> logins = new HashSet<String>();
+ final Set<String> logins = new HashSet<>();
for(String key : configurationService.listConfigurationKeys("user")) {
String[] components = key.split("\\.");
if(components.length > 2 && "webid".equals(components[2])) {
@@ -112,16 +112,16 @@ public class AccountServiceImpl implements AccountService {
}
}
- final List<UserAccount> list = new ArrayList<UserAccount>();
+ final List<UserAccount> list = new ArrayList<>();
for(String login : logins) {
list.add(getAccount(login));
}
-
for (UserAccount userAccount : list) {
userCache.put(userAccount.getLogin(), userAccount);
userCache.put(userAccount.getWebId(), userAccount);
}
+
return list;
}
@@ -190,9 +190,13 @@ public class AccountServiceImpl implements AccountService {
account = new UserAccount();
account.setLogin(login);
- account.setPasswdHash(configurationService.getStringConfiguration("user."+login+".pwhash"));
- account.setRoles(new HashSet<String>(configurationService.getListConfiguration("user."+login+".roles")));
+ account.setRoles(new HashSet<>(configurationService.getListConfiguration("user."+login+".roles")));
account.setWebId(configurationService.getStringConfiguration("user."+login+".webid"));
+ if (configurationService.isConfigurationSet(configurationService.getStringConfiguration("user."+login+".pwhash"))) {
+ account.setPasswdHash(configurationService.getStringConfiguration("user." + login + ".pwhash"));
+ } else {
+ account.setPasswd(configurationService.getStringConfiguration("user." + login + ".password"));
+ }
userCache.put(account.getLogin(), account);
userCache.put(account.getWebId(), account);