mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-1239: Make identifier comparison case-insensitive.
This commit is contained in:
@@ -362,5 +362,26 @@ public class ConfigurationService {
|
||||
throw new GuacamoleServerException("Unknown host specified for NAS IP.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the usernames provided to the RADIUS authentication
|
||||
* module should be treated as case-sensitive, or false if usernames
|
||||
* should be treated as case-insensitive. The default value is read from
|
||||
* Guacamole's global configuration, which defaults to true, but can be
|
||||
* overridden for the RADIUS extension, if desired.
|
||||
*
|
||||
* @return
|
||||
* true if usernames should be treated as case-sensitive, otherwise
|
||||
* false.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If guacamole.properties cannot be parsed.
|
||||
*/
|
||||
public boolean getCaseSensitiveUsernames() throws GuacamoleException {
|
||||
return environment.getProperty(
|
||||
RadiusGuacamoleProperties.RADIUS_CASE_SENSITIVE_USERNAMES,
|
||||
environment.getCaseSensitiveUsernames()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -204,6 +204,18 @@ public class RadiusGuacamoleProperties {
|
||||
public String getName() { return "radius-nas-ip"; }
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* A property used to configure whether or not usernames within the RADIUS
|
||||
* module should be treated as case-sensitive.
|
||||
*/
|
||||
public static final BooleanGuacamoleProperty RADIUS_CASE_SENSITIVE_USERNAMES =
|
||||
new BooleanGuacamoleProperty() {
|
||||
|
||||
@Override
|
||||
public String getName() { return "radius-case-sensitive-usernames"; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@ import com.google.inject.Inject;
|
||||
import org.apache.guacamole.net.auth.AbstractAuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* An RADIUS-specific implementation of AuthenticatedUser, associating a
|
||||
@@ -30,12 +32,23 @@ import org.apache.guacamole.net.auth.Credentials;
|
||||
*/
|
||||
public class AuthenticatedUser extends AbstractAuthenticatedUser {
|
||||
|
||||
/**
|
||||
* Logger for this class.
|
||||
*/
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticatedUser.class);
|
||||
|
||||
/**
|
||||
* Reference to the authentication provider associated with this
|
||||
* authenticated user.
|
||||
*/
|
||||
@Inject
|
||||
private AuthenticationProvider authProvider;
|
||||
|
||||
/**
|
||||
* A reference to the configuration service associated with this module.
|
||||
*/
|
||||
@Inject
|
||||
private ConfigurationService confService;
|
||||
|
||||
/**
|
||||
* The credentials provided when this user was authenticated.
|
||||
@@ -62,5 +75,18 @@ public class AuthenticatedUser extends AbstractAuthenticatedUser {
|
||||
public Credentials getCredentials() {
|
||||
return credentials;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCaseSensitive() {
|
||||
try {
|
||||
return confService.getCaseSensitiveUsernames();
|
||||
}
|
||||
catch (GuacamoleException e) {
|
||||
LOGGER.error("Error retrieving configuration for username case sensiivity. "
|
||||
+ "Usernames will be processed as case-sensitive.");
|
||||
LOGGER.debug("Exception caught while retrieving RADIUS configuration.", e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user