From adc745da4388f693e0672391016d36a85b42369b Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 22 Jan 2015 16:26:07 -0800 Subject: [PATCH] GUAC-1001: Generate username within SimpleAuthenticationProvider if no username is given. --- .../net/auth/simple/SimpleAuthenticationProvider.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/simple/SimpleAuthenticationProvider.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/simple/SimpleAuthenticationProvider.java index f899ce036..52fb333a5 100644 --- a/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/simple/SimpleAuthenticationProvider.java +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/simple/SimpleAuthenticationProvider.java @@ -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 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); }