Skip to content

Commit

Permalink
Check for stale timestamp in updateUserContext()
Browse files Browse the repository at this point in the history
  • Loading branch information
krambmal committed Nov 5, 2014
1 parent 085d595 commit a0bdef7
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import junit.framework.TestCase;
import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.net.auth.Credentials;
import org.glyptodon.guacamole.net.auth.UserContext;
import org.glyptodon.guacamole.net.auth.simple.SimpleUserContext;
import org.glyptodon.guacamole.properties.GuacamoleProperties;
import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
import org.mockito.invocation.InvocationOnMock;
Expand Down Expand Up @@ -101,10 +103,16 @@ public void testTimestampStale() throws Exception {
HmacAuthenticationProvider authProvider = new HmacAuthenticationProvider(timeProvider);

Map<String, GuacamoleConfiguration> configs = authProvider.getAuthorizedConfigurations(credentials);

assertNull(configs);

// test that updateUserContext also returns null when the timestamp is stale
Map<String, GuacamoleConfiguration> dummyConfigs = new HashMap<String, GuacamoleConfiguration>();
dummyConfigs.put("dummy", new GuacamoleConfiguration());
SimpleUserContext context = new SimpleUserContext(dummyConfigs);
UserContext updatedUserContext = authProvider.updateUserContext(context, credentials);
assertNull(updatedUserContext);
}

private HttpServletRequest getHttpServletRequest() {
return getHttpServletRequest(connectionId);
}
Expand Down

0 comments on commit a0bdef7

Please sign in to comment.