projects
/
guacamole.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e853f0b
)
Improved logging for user-mapping and login.
author
Michael Jumper <zhangmaike@users.sourceforge.net>
Fri, 15 Jul 2011 07:14:47 +0000
(
00:14
-0700)
committer
Michael Jumper <zhangmaike@users.sourceforge.net>
Fri, 15 Jul 2011 07:14:47 +0000
(
00:14
-0700)
src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java
patch
|
blob
|
history
src/main/java/net/sourceforge/guacamole/net/basic/BasicGuacamoleTunnelServlet.java
patch
|
blob
|
history
diff --git
a/src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java
b/src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java
index
eefa6aa
..
ce8d5b8
100644
(file)
--- a/
src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java
+++ b/
src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java
@@
-30,6
+30,8
@@
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.basic.properties.BasicGuacamoleProperties;
import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
import net.sourceforge.guacamole.properties.GuacamoleProperties;
import net.sourceforge.guacamole.net.basic.properties.BasicGuacamoleProperties;
import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
import net.sourceforge.guacamole.properties.GuacamoleProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
@@
-38,6
+40,8
@@
import org.xml.sax.helpers.XMLReaderFactory;
public class BasicFileAuthenticationProvider implements AuthenticationProvider {
public class BasicFileAuthenticationProvider implements AuthenticationProvider {
+ private Logger logger = LoggerFactory.getLogger(BasicFileAuthenticationProvider.class);
+
private long mappingTime;
private Map<String, AuthInfo> mapping;
private long mappingTime;
private Map<String, AuthInfo> mapping;
@@
-55,6
+59,8
@@
public class BasicFileAuthenticationProvider implements AuthenticationProvider {
if (mapFile == null)
throw new GuacamoleException("Missing \"basic-user-mapping\" parameter required for basic login.");
if (mapFile == null)
throw new GuacamoleException("Missing \"basic-user-mapping\" parameter required for basic login.");
+ logger.info("Reading user mapping file: {}", mapFile);
+
// Parse document
try {
// Parse document
try {
@@
-86,8
+92,10
@@
public class BasicFileAuthenticationProvider implements AuthenticationProvider {
// If modified recently, gain exclusive access and recheck
synchronized (this) {
// If modified recently, gain exclusive access and recheck
synchronized (this) {
- if (userMappingFile.exists() && mappingTime < userMappingFile.lastModified())
+ if (userMappingFile.exists() && mappingTime < userMappingFile.lastModified()) {
+ logger.info("User mapping file {} has been modified.", userMappingFile);
init(); // If still not up to date, re-init
init(); // If still not up to date, re-init
+ }
}
}
}
}
diff --git
a/src/main/java/net/sourceforge/guacamole/net/basic/BasicGuacamoleTunnelServlet.java
b/src/main/java/net/sourceforge/guacamole/net/basic/BasicGuacamoleTunnelServlet.java
index
7416505
..
e2d447f
100644
(file)
--- a/
src/main/java/net/sourceforge/guacamole/net/basic/BasicGuacamoleTunnelServlet.java
+++ b/
src/main/java/net/sourceforge/guacamole/net/basic/BasicGuacamoleTunnelServlet.java
@@
-48,6
+48,7
@@
public class BasicGuacamoleTunnelServlet extends GuacamoleTunnelServlet {
authProvider = GuacamoleProperties.getProperty(BasicGuacamoleProperties.AUTH_PROVIDER);
}
catch (GuacamoleException e) {
authProvider = GuacamoleProperties.getProperty(BasicGuacamoleProperties.AUTH_PROVIDER);
}
catch (GuacamoleException e) {
+ logger.error("Error getting authentication provider from properties.", e);
throw new ServletException(e);
}
throw new ServletException(e);
}
@@
-63,13
+64,21
@@
public class BasicGuacamoleTunnelServlet extends GuacamoleTunnelServlet {
String password = request.getParameter("password");
// Get authorized config
String password = request.getParameter("password");
// Get authorized config
- GuacamoleConfiguration config = authProvider.getAuthorizedConfiguration(username, password);
+ GuacamoleConfiguration config;
+ try {
+ config = authProvider.getAuthorizedConfiguration(username, password);
+ }
+ catch (GuacamoleException e) {
+ logger.error("Error retrieving authorized configuration for user {}.", username);
+ throw e;
+ }
+
if (config == null) {
logger.warn("Failed login from {} for user \"{}\".", request.getRemoteAddr(), username);
throw new GuacamoleException("Invalid login");
}
if (config == null) {
logger.warn("Failed login from {} for user \"{}\".", request.getRemoteAddr(), username);
throw new GuacamoleException("Invalid login");
}
- logger.debug("Successful login from {} for user \"{}\".", request.getRemoteAddr(), username);
+ logger.info("Successful login from {} for user \"{}\".", request.getRemoteAddr(), username);
// Configure and connect socket
String hostname = GuacamoleProperties.getProperty(GuacamoleProperties.GUACD_HOSTNAME);
// Configure and connect socket
String hostname = GuacamoleProperties.getProperty(GuacamoleProperties.GUACD_HOSTNAME);