mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-1661: Parse config only once when iterating records.
This commit is contained in:
@@ -277,13 +277,13 @@ public class KsmClient {
|
|||||||
cachedAmbiguousDomains.clear();
|
cachedAmbiguousDomains.clear();
|
||||||
cachedRecordsByDomain.clear();
|
cachedRecordsByDomain.clear();
|
||||||
|
|
||||||
|
// Parse configuration
|
||||||
|
final boolean shouldSplitUsernames = confService.getSplitWindowsUsernames();
|
||||||
|
final boolean shouldMatchByDomain = confService.getMatchUserRecordsByDomain();
|
||||||
|
|
||||||
// Store all records, sorting each into host-based, login-based,
|
// Store all records, sorting each into host-based, login-based,
|
||||||
// and domain-based buckets
|
// and domain-based buckets
|
||||||
Iterator<KeeperRecord> recordIterator = records.iterator();
|
records.forEach(record -> {
|
||||||
while(recordIterator.hasNext()) {
|
|
||||||
|
|
||||||
// Go through records one at a time
|
|
||||||
KeeperRecord record = recordIterator.next();
|
|
||||||
|
|
||||||
// Store based on UID ...
|
// Store based on UID ...
|
||||||
cachedRecordsByUid.put(record.getRecordUid(), record);
|
cachedRecordsByUid.put(record.getRecordUid(), record);
|
||||||
@@ -300,8 +300,7 @@ public class KsmClient {
|
|||||||
String username = recordService.getUsername(record);
|
String username = recordService.getUsername(record);
|
||||||
|
|
||||||
// If we have a username, and there isn't already a domain explicitly defined
|
// If we have a username, and there isn't already a domain explicitly defined
|
||||||
if (username != null && domain == null
|
if (username != null && domain == null && shouldSplitUsernames) {
|
||||||
&& confService.getSplitWindowsUsernames()) {
|
|
||||||
|
|
||||||
// Attempt to split out the domain of the username
|
// Attempt to split out the domain of the username
|
||||||
WindowsUsername usernameAndDomain = (
|
WindowsUsername usernameAndDomain = (
|
||||||
@@ -319,7 +318,7 @@ public class KsmClient {
|
|||||||
// If domain matching is not enabled for user records,
|
// If domain matching is not enabled for user records,
|
||||||
// explicitly set all domains to null to allow matching
|
// explicitly set all domains to null to allow matching
|
||||||
// on username only
|
// on username only
|
||||||
if (!confService.getMatchUserRecordsByDomain())
|
if (!shouldMatchByDomain)
|
||||||
domain = null;
|
domain = null;
|
||||||
|
|
||||||
// Store based on login ONLY if no hostname (will otherwise
|
// Store based on login ONLY if no hostname (will otherwise
|
||||||
@@ -328,7 +327,7 @@ public class KsmClient {
|
|||||||
if (hostname == null)
|
if (hostname == null)
|
||||||
addRecordForLogin(record, username, domain);
|
addRecordForLogin(record, username, domain);
|
||||||
|
|
||||||
}
|
});
|
||||||
|
|
||||||
// Cache has been refreshed
|
// Cache has been refreshed
|
||||||
this.cacheTimestamp = System.currentTimeMillis();
|
this.cacheTimestamp = System.currentTimeMillis();
|
||||||
|
Reference in New Issue
Block a user