improved logging
This commit is contained in:
@ -10,6 +10,7 @@ import javax.faces.context.ExternalContext;
|
|||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.faces.view.ViewScoped;
|
import javax.faces.view.ViewScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
import javax.naming.NamingException;
|
||||||
|
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
@ -68,8 +69,17 @@ public class LoginView implements Serializable {
|
|||||||
String hint = "Error while authenticating user " + username;
|
String hint = "Error while authenticating user " + username;
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
LOGGER.debug(hint, ex);
|
LOGGER.debug(hint, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ex.getMessage() != null) {
|
||||||
|
hint += "Reason: " + ex.getMessage();
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error(hint + " Reason: " + ex.toString());
|
hint += "Reason: " + ex.toString();
|
||||||
|
}
|
||||||
|
if ((ex.getCause() != null) && (ex.getCause().getMessage() != null)) {
|
||||||
|
hint += "Rootcause: " + ex.getMessage();
|
||||||
|
|
||||||
|
LOGGER.error(hint);
|
||||||
}
|
}
|
||||||
FacesUtil.addGlobalErrorMessage("Login failed", hint);
|
FacesUtil.addGlobalErrorMessage("Login failed", hint);
|
||||||
|
|
||||||
|
|||||||
@ -39,15 +39,20 @@ public class UserNameActiveDirectoryRealm extends ActiveDirectoryRealm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Binds using the username and password provided by the user.
|
// Binds using the username and password provided by the user.
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
LOGGER.debug("start creating context");
|
LOGGER.debug("start creating context");
|
||||||
|
}
|
||||||
ctx = ldapContextFactory.getLdapContext(userName, upToken.getCredentials());
|
ctx = ldapContextFactory.getLdapContext(userName, upToken.getCredentials());
|
||||||
LOGGER.debug("context created");
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug("User {} LDAP authenticated", userName);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
LdapUtils.closeContext(ctx);
|
LdapUtils.closeContext(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.debug("building authentication info");
|
LOGGER.debug("building authentication info");
|
||||||
AuthenticationInfo authInfo = buildAuthenticationInfo(userName, upToken.getPassword());
|
AuthenticationInfo authInfo = buildAuthenticationInfo(userName, upToken.getPassword());
|
||||||
|
|
||||||
LOGGER.debug("authentifaction info created");
|
LOGGER.debug("authentifaction info created");
|
||||||
return authInfo;
|
return authInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user