diff --git a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/properties/BasicGuacamoleProperties.java b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/properties/BasicGuacamoleProperties.java index 386cd8852..a2ae39d51 100644 --- a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/properties/BasicGuacamoleProperties.java +++ b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/properties/BasicGuacamoleProperties.java @@ -24,7 +24,7 @@ package org.glyptodon.guacamole.net.basic.properties; import org.glyptodon.guacamole.properties.BooleanGuacamoleProperty; import org.glyptodon.guacamole.properties.FileGuacamoleProperty; -import org.glyptodon.guacamole.properties.LongGuacamoleProperty; +import org.glyptodon.guacamole.properties.IntegerGuacamoleProperty; /** * Properties used by the default Guacamole web application. @@ -82,9 +82,9 @@ public class BasicGuacamoleProperties { }; /** - * The session timeout for the API, in milliseconds. + * The session timeout for the API, in minutes. */ - public static final LongGuacamoleProperty API_SESSION_TIMEOUT = new LongGuacamoleProperty() { + public static final IntegerGuacamoleProperty API_SESSION_TIMEOUT = new IntegerGuacamoleProperty() { @Override public String getName() { return "api-session-timeout"; } diff --git a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/auth/BasicTokenSessionMap.java b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/auth/BasicTokenSessionMap.java index e7c88ad55..50344f484 100644 --- a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/auth/BasicTokenSessionMap.java +++ b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/auth/BasicTokenSessionMap.java @@ -65,20 +65,21 @@ public class BasicTokenSessionMap implements TokenSessionMap { */ public BasicTokenSessionMap() { - long sessionTimeoutValue; + int sessionTimeoutValue; // Read session timeout from guacamole.properties try { - sessionTimeoutValue = GuacamoleProperties.getProperty(BasicGuacamoleProperties.API_SESSION_TIMEOUT, 3600000l); + sessionTimeoutValue = GuacamoleProperties.getProperty(BasicGuacamoleProperties.API_SESSION_TIMEOUT, 60); } catch (GuacamoleException e) { logger.error("Unable to read guacamole.properties: {}", e.getMessage()); logger.debug("Error while reading session timeout value.", e); - sessionTimeoutValue = 3600000l; + sessionTimeoutValue = 60; } // Check for expired sessions every minute - executor.scheduleAtFixedRate(new SessionEvictionTask(sessionTimeoutValue), 1, 1, TimeUnit.MINUTES); + logger.info("Sessions will expire after {} minutes of inactivity.", sessionTimeoutValue); + executor.scheduleAtFixedRate(new SessionEvictionTask(sessionTimeoutValue * 60000l), 1, 1, TimeUnit.MINUTES); }