GUAC-1001: Generate username within SimpleAuthenticationProvider if no username is given.

This commit is contained in:
Michael Jumper
2015-01-22 16:26:07 -08:00
parent 4940f34483
commit adc745da43

View File

@@ -66,6 +66,9 @@ public abstract class SimpleAuthenticationProvider
public UserContext getUserContext(Credentials credentials)
throws GuacamoleException {
// Get username, if any
String username = credentials.getUsername();
// Get configurations
Map<String, GuacamoleConfiguration> configs =
getAuthorizedConfigurations(credentials);
@@ -83,7 +86,12 @@ public abstract class SimpleAuthenticationProvider
tokenFilter.filterValues(config.getParameters());
// Return user context restricted to authorized configs
return new SimpleUserContext(credentials.getUsername(), configs);
if (username != null)
return new SimpleUserContext(username, configs);
// If there is no associated username, let SimpleUserContext generate one
else
return new SimpleUserContext(configs);
}