Skip to content

Commit

Permalink
logging improved
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwechner committed Nov 17, 2012
1 parent 2dfed97 commit 56ad7f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
Expand Up @@ -1284,8 +1284,7 @@ private HttpServletResponse doAccessControl(HttpServletRequest request, HttpServ
return response;
} else {
try {
log.warn("DEBUG: Authentication was successful for user: " + identity.getUsername());
//log.warn("Authentication was successful for user: " + getIdentity(request, map).getUsername());
//log.debug("Authentication was successful for user: " + getIdentity(request, map).getUsername());
} catch (Exception e) {
log.error(e.getMessage(), e);
}
Expand Down Expand Up @@ -1788,6 +1787,7 @@ public static Identity getIdentity(HttpSession session, Realm realm) throws Exce
* @return Identity if one exist, or otherwise null
*/
public static Identity getIdentity(HttpSession session, String realmID) throws Exception {
//log.debug("Get identity from session for realm '" + realmID + "'.");
if (session != null) {
IdentityMap identityMap = (IdentityMap)session.getAttribute(IDENTITY_MAP_KEY);
if (identityMap != null) {
Expand Down Expand Up @@ -1826,6 +1826,7 @@ public static void setIdentity(Identity identity, HttpSession session, Realm rea
* @return Identity if one exist, or otherwise an empty identity (which is considered to be WORLD)
*/
private static Identity getIdentity(HttpServletRequest request, Realm realm) throws Exception {
//log.debug("Get identity for request '" + request.getServletPath() + "'.");
Identity identity = getIdentity(request.getSession(false), realm);
if (identity != null) { // INFO: Please note that the WORLD identity (or rather an empty identity) is not added to the session (please see further down)
//log.debug("Identity from session: " + identity);
Expand All @@ -1852,6 +1853,7 @@ private static Identity getIdentity(HttpServletRequest request, Realm realm) thr
String trueID = realm.getIdentityManager().getUserManager().getTrueId(username);
User user = realm.getIdentityManager().getUserManager().getUser(trueID);
if (user != null && user.authenticate(password)) {
log.debug("User '" + user.getID() + "' successfully authenticated via BASIC authentication.");
return new Identity(user, username);
} else {
log.warn("HTTP BASIC Authentication failed for " + username + " (True ID: '" + trueID + "') and request '" + request.getServletPath() + "', hence set identity to WORLD!");
Expand Down

0 comments on commit 56ad7f7

Please sign in to comment.