mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-1224: Log identifiers of extensions reporting authentication failures.
This commit is contained in:
@@ -22,6 +22,7 @@ package org.apache.guacamole.event;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.GuacamoleResourceNotFoundException;
|
import org.apache.guacamole.GuacamoleResourceNotFoundException;
|
||||||
|
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||||
import org.apache.guacamole.net.auth.Credentials;
|
import org.apache.guacamole.net.auth.Credentials;
|
||||||
import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException;
|
import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException;
|
||||||
import org.apache.guacamole.net.event.ApplicationShutdownEvent;
|
import org.apache.guacamole.net.event.ApplicationShutdownEvent;
|
||||||
@@ -144,6 +145,8 @@ public class EventLoggingListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
private void logFailure(AuthenticationFailureEvent event) {
|
private void logFailure(AuthenticationFailureEvent event) {
|
||||||
|
|
||||||
|
AuthenticationProvider authProvider = event.getAuthenticationProvider();
|
||||||
|
|
||||||
Credentials creds = event.getCredentials();
|
Credentials creds = event.getCredentials();
|
||||||
String username = creds.getUsername();
|
String username = creds.getUsername();
|
||||||
|
|
||||||
@@ -154,14 +157,27 @@ public class EventLoggingListener implements Listener {
|
|||||||
else if (username == null || username.isEmpty())
|
else if (username == null || username.isEmpty())
|
||||||
logger.debug("Anonymous authentication attempt from {} failed: {}",
|
logger.debug("Anonymous authentication attempt from {} failed: {}",
|
||||||
new RemoteAddress(creds), new Failure(event));
|
new RemoteAddress(creds), new Failure(event));
|
||||||
else if (event.getFailure() instanceof GuacamoleInsufficientCredentialsException)
|
else if (event.getFailure() instanceof GuacamoleInsufficientCredentialsException) {
|
||||||
logger.debug("Authentication attempt from {} for user \"{}\" "
|
if (authProvider != null)
|
||||||
+ "requires additional credentials to continue: {}",
|
logger.debug("Authentication attempt from {} for user \"{}\" "
|
||||||
new RemoteAddress(creds), username, new Failure(event));
|
+ "requires additional credentials to continue: {} "
|
||||||
else
|
+ "(requested by \"{}\")", new RemoteAddress(creds),
|
||||||
logger.warn("Authentication attempt from {} for user \"{}\" "
|
username, new Failure(event), authProvider.getIdentifier());
|
||||||
+ "failed: {}", new RemoteAddress(creds), username,
|
else
|
||||||
new Failure(event));
|
logger.debug("Authentication attempt from {} for user \"{}\" "
|
||||||
|
+ "requires additional credentials to continue: {}",
|
||||||
|
new RemoteAddress(creds), username, new Failure(event));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (authProvider != null)
|
||||||
|
logger.warn("Authentication attempt from {} for user \"{}\" "
|
||||||
|
+ "failed: {} (rejected by \"{}\")", new RemoteAddress(creds),
|
||||||
|
username, new Failure(event), authProvider.getIdentifier());
|
||||||
|
else
|
||||||
|
logger.warn("Authentication attempt from {} for user \"{}\" "
|
||||||
|
+ "failed: {}", new RemoteAddress(creds), username,
|
||||||
|
new Failure(event));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user