This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git


The following commit(s) were added to refs/heads/master by this push:
     new feaefaee Minor - improving trace logging on security filter
feaefaee is described below

commit feaefaeebb15ce6ea3581c40331008ab58344bc1
Author: Dan Klco <[email protected]>
AuthorDate: Fri Apr 28 06:51:10 2023 -0400

    Minor - improving trace logging on security filter
---
 .../apache/sling/cms/core/internal/filters/CMSSecurityFilter.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/core/src/main/java/org/apache/sling/cms/core/internal/filters/CMSSecurityFilter.java
 
b/core/src/main/java/org/apache/sling/cms/core/internal/filters/CMSSecurityFilter.java
index cf77932a..b65a1f5c 100644
--- 
a/core/src/main/java/org/apache/sling/cms/core/internal/filters/CMSSecurityFilter.java
+++ 
b/core/src/main/java/org/apache/sling/cms/core/internal/filters/CMSSecurityFilter.java
@@ -77,16 +77,20 @@ public class CMSSecurityFilter implements Filter {
         if (pubMgrFactory.getPublicationMode() == PUBLICATION_MODE.STANDALONE) 
{
             SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) 
request;
             for (CMSSecurityConfigInstance securityConfig : 
securityConfigInstances) {
-                log.trace("Checking to see if security config {} applies to 
request", securityConfig);
                 if (securityConfig.applies(slingRequest)) {
+                    log.trace("Security config {} applies to request to {}", 
securityConfig, request.getServerName());
                     boolean allowed = checkAllowed(securityConfig, 
slingRequest);
                     // permission checked failed, so return an unauthorized 
error
                     if (!allowed) {
-                        log.trace("Request to {} not allowed for user {}", 
slingRequest.getRequestURI(),
+                        log.trace("Request to {} not allowed for user {}", 
slingRequest.getRequestURL(),
                                 
slingRequest.getResourceResolver().getUserID());
                         ((HttpServletResponse) 
response).sendError(HttpStatus.SC_UNAUTHORIZED);
                         return;
+                    } else {
+                        log.trace("Request {} allowed", 
slingRequest.getRequestURL());
                     }
+                } else {
+                    log.trace("Security config {} does not apply to request to 
{}", securityConfig, request.getServerName());
                 }
             }
         } else {

Reply via email to