mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 14:11:21 +00:00
Only log successful auth when initially creating context.
This commit is contained in:
@@ -247,14 +247,22 @@ public abstract class AuthenticatingHttpServlet extends HttpServlet {
|
|||||||
SessionListenerCollection listeners = new SessionListenerCollection(httpSession);
|
SessionListenerCollection listeners = new SessionListenerCollection(httpSession);
|
||||||
|
|
||||||
// If no cached context, attempt to get new context
|
// If no cached context, attempt to get new context
|
||||||
if (context == null)
|
if (context == null) {
|
||||||
|
|
||||||
context = authProvider.getUserContext(credentials);
|
context = authProvider.getUserContext(credentials);
|
||||||
|
|
||||||
|
// Log successful authentication
|
||||||
|
if (context != null)
|
||||||
|
logger.info("User \"{}\" successfully authenticated from {}.",
|
||||||
|
context.self().getUsername(), request.getRemoteAddr());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise, update existing context
|
// Otherwise, update existing context
|
||||||
else
|
else
|
||||||
context = authProvider.updateUserContext(context, credentials);
|
context = authProvider.updateUserContext(context, credentials);
|
||||||
|
|
||||||
// If no context, fail authentication, notify listeners
|
// If auth failed, notify listeners
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
logger.warn("Authentication attempt from {} for user \"{}\" failed.",
|
logger.warn("Authentication attempt from {} for user \"{}\" failed.",
|
||||||
request.getRemoteAddr(), credentials.getUsername());
|
request.getRemoteAddr(), credentials.getUsername());
|
||||||
@@ -262,23 +270,16 @@ public abstract class AuthenticatingHttpServlet extends HttpServlet {
|
|||||||
notifyFailed(listeners, credentials);
|
notifyFailed(listeners, credentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, associate (possibly updated) context with session
|
// If auth succeeded, notify and check with listeners
|
||||||
// and notify listeners
|
else if (!notifySuccess(listeners, context, credentials)) {
|
||||||
else {
|
logger.info("Successful authentication canceled by hook.");
|
||||||
|
context = null;
|
||||||
// Log successful authentication
|
|
||||||
logger.info("User \"{}\" successfully authenticated from {}.",
|
|
||||||
context.self().getUsername(), request.getRemoteAddr());
|
|
||||||
|
|
||||||
if (!notifySuccess(listeners, context, credentials)) {
|
|
||||||
logger.info("Successful authentication canceled by hook.");
|
|
||||||
context = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
httpSession.setAttribute(CONTEXT_ATTRIBUTE, context);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If auth still OK, associate context with session
|
||||||
|
else
|
||||||
|
httpSession.setAttribute(CONTEXT_ATTRIBUTE, context);
|
||||||
|
|
||||||
} // end if credentials present
|
} // end if credentials present
|
||||||
|
|
||||||
// If no context, no authorizaton present
|
// If no context, no authorizaton present
|
||||||
|
Reference in New Issue
Block a user