return;
}
// authenticate user
UserManager userManager = context.getUserManager();
User authenticatedUser = null;
try {
UserMetadata userMetadata = new UserMetadata();
if(session.getRemoteAddress() instanceof InetSocketAddress) {
userMetadata.setInetAddress(((InetSocketAddress)session.getRemoteAddress()).getAddress());
}
userMetadata.setCertificateChain(session.getClientCertificates());
Authentication auth;
if(anonymous) {
auth = new AnonymousAuthentication(userMetadata);
}
else {
auth = new UsernamePasswordAuthentication(userName, password, userMetadata);
}
authenticatedUser = userManager.authenticate(auth);
} catch(AuthenticationFailedException e) {
authenticatedUser = null;
LOG.warn("User failed to log in");
}
catch(Exception e) {
authenticatedUser = null;
LOG.warn("PASS.execute()", e);
}
// set the user so that the Ftplets will be able to verify it
// first save old values so that we can reset them if Ftplets
// tell us to fail
User oldUser = session.getUser();
String oldUserArgument = session.getUserArgument();
int oldMaxIdleTime = session.getMaxIdleTime();
if(authenticatedUser != null) {
session.setUser(authenticatedUser);