Repository: struts Updated Branches: refs/heads/master 4969750f3 -> d8c406251
WW-4523 - Add more log statements to RolesInterceptor Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/72e8b109 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/72e8b109 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/72e8b109 Branch: refs/heads/master Commit: 72e8b109b5b1da013678b2910fb28e20a6c1db1a Parents: d0a25d6 Author: Aleksandr Mashchenko <[email protected]> Authored: Fri Jul 10 21:40:30 2015 +0300 Committer: Aleksandr Mashchenko <[email protected]> Committed: Fri Jul 10 21:40:30 2015 +0300 ---------------------------------------------------------------------- .../apache/struts2/interceptor/RolesInterceptor.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/72e8b109/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java index 9177ea2..5b95fef 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java @@ -120,8 +120,14 @@ public class RolesInterceptor extends AbstractInterceptor { throw new IllegalArgumentException("RolesInterceptor is misconfigured, check logs for erroneous configuration!"); } if (!isAllowed(request, invocation.getAction())) { + if (LOG.isDebugEnabled()) { + LOG.debug("Request is NOT allowed. Rejecting."); + } return handleRejection(invocation, response); } else { + if (LOG.isDebugEnabled()) { + LOG.debug("Request is allowed. Invoking."); + } return invocation.invoke(); } } @@ -148,16 +154,25 @@ public class RolesInterceptor extends AbstractInterceptor { protected boolean isAllowed(HttpServletRequest request, Object action) { for (String role : disallowedRoles) { if (request.isUserInRole(role)) { + if (LOG.isDebugEnabled()) { + LOG.debug("User role '" + role + "' is in the disallowedRoles list."); + } return false; } } if (allowedRoles.isEmpty()){ + if (LOG.isDebugEnabled()) { + LOG.debug("The allowedRoles list is empty."); + } return true; } for (String role : allowedRoles) { if (request.isUserInRole(role)) { + if (LOG.isDebugEnabled()) { + LOG.debug("User role '" + role + "' is in the allowedRoles list."); + } return true; } }
