private void addRecordForLogin(
            KeeperRecord record, String username, String domain) {

        if (username == null)
            return;

        UserLogin userDomain = new UserLogin(username, domain);
        KeeperRecord existing = cachedRecordsByUser.putIfAbsent(
                userDomain, record);
        if (existing != null && record != existing)
            cachedAmbiguousUsers.add(userDomain);

    }
Associates the given record with the given user, and optional domain.
The given username or domain may be null. Both {@link #cachedRecordsByUser}
and {@link #cachedAmbiguousUsers} are updated appropriately. The write
lock of {@link #cacheLock} must already be acquired before invoking this
function.

@param record
    The record to associate with the given user.

@param username
    The username that the given record should be associated with. This
    may be null.

@param domain
    The domain that the given record should be associated with. This
    may be null.
extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmClient.java