GUACAMOLE-1239: Remove per-extension configuration for case-sensitivity, retaining only global configuration.

This commit is contained in:
Virtually Nick
2024-10-31 13:30:46 -04:00
parent 240dcd9a52
commit ddd09969d8
31 changed files with 37 additions and 469 deletions

View File

@@ -21,6 +21,11 @@ package org.apache.guacamole.net.auth;
import java.util.Collections;
import java.util.Set;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.environment.Environment;
import org.apache.guacamole.environment.LocalEnvironment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Basic implementation of an AuthenticatedUser which uses the username to
@@ -29,6 +34,17 @@ import java.util.Set;
public abstract class AbstractAuthenticatedUser extends AbstractIdentifiable
implements AuthenticatedUser {
/**
* The logger for this class.
*/
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractAuthenticatedUser.class);
/**
* The server environment in which this Guacamole Client instance is
* running.
*/
private final Environment environment = LocalEnvironment.getInstance();
// Prior functionality now resides within AbstractIdentifiable
@Override
@@ -36,6 +52,21 @@ public abstract class AbstractAuthenticatedUser extends AbstractIdentifiable
return Collections.<String>emptySet();
}
@Override
public boolean isCaseSensitive() {
try {
return environment.getCaseSensitiveUsernames();
}
catch (GuacamoleException e) {
LOGGER.warn("Exception attempting to read the Guacamole configuration, "
+ "usernames will be treated as case-sensitive.", e.getMessage());
LOGGER.debug("Received GuacamoleException attempting to retrieve the "
+ "case-sensitivity setting for usernames. Defaulting to"
+ "case-sensitive usernames.", e);
return true;
}
}
@Override
public void invalidate() {
// Nothing to invalidate

View File

@@ -83,6 +83,11 @@ public class DelegatingUser implements User {
return user.isDisabled();
}
@Override
public boolean isCaseSensitive() {
return user.isCaseSensitive();
}
@Override
public void setDisabled(boolean disabled) {
user.setDisabled(disabled);