[cpp-sp] branch main updated: SSPCPP-957 - Log additional details when attribute is filtered out

Scott Cantor cantor.2 at osu.edu
Mon Oct 24 14:12:38 UTC 2022


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=418a3d43db87eb5ab4d6c21a6166db23674b782a

The following commit(s) were added to refs/heads/main by this push:
     new 418a3d43 SSPCPP-957 - Log additional details when attribute is filtered out
418a3d43 is described below

commit 418a3d43db87eb5ab4d6c21a6166db23674b782a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Oct 24 10:12:07 2022 -0400

    SSPCPP-957 - Log additional details when attribute is filtered out
    
    https://shibboleth.atlassian.net/browse/SSPCPP-957
---
 .../filtering/impl/AttributeMatchesShibMDScopeFunctor.cpp | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/shibsp/attribute/filtering/impl/AttributeMatchesShibMDScopeFunctor.cpp b/shibsp/attribute/filtering/impl/AttributeMatchesShibMDScopeFunctor.cpp
index 19a82595..23f0b879 100644
--- a/shibsp/attribute/filtering/impl/AttributeMatchesShibMDScopeFunctor.cpp
+++ b/shibsp/attribute/filtering/impl/AttributeMatchesShibMDScopeFunctor.cpp
@@ -48,7 +48,9 @@ namespace shibsp {
     class SHIBSP_DLLLOCAL AbstractAttributeMatchesShibMDScopeFunctor : public MatchFunctor
     {
     public:
-        bool evaluatePolicyRequirement(const FilteringContext& filterContext) const {
+        AbstractAttributeMatchesShibMDScopeFunctor() : m_log(Category::getInstance(SHIBSP_LOGCAT ".AttributeFilter")) {}
+
+        bool evaluatePolicyRequirement(const FilteringContext&) const {
             throw AttributeFilteringException("Metadata scope matching not usable as a PolicyRequirement.");
         }
 
@@ -58,8 +60,10 @@ namespace shibsp {
                 return false;
 
             const char* s = getStringToMatch(attribute, index);
-            if (!s || !*s)
+            if (!s || !*s) {
+                m_log.warn("attribute (%s) missing scope", attribute.getId());
                 return false;
+            }
             auto_arrayptr<XMLCh> widestr(fromUTF8(s));
 
             const Scope* rule;
@@ -85,6 +89,7 @@ namespace shibsp {
                 }
             }
 
+            m_log.warn("attribute (%s) invalid scope (%s)", attribute.getId(), s);
             return false;
         }
 
@@ -92,6 +97,8 @@ namespace shibsp {
         virtual const char* getStringToMatch(const Attribute& attribute, size_t index) const = 0;
 
     private:
+        Category& m_log;
+
         bool matches(const Scope& rule, auto_arrayptr<XMLCh>& scope) const {
             const XMLCh* val = rule.getValue();
             if (val && *val) {
@@ -129,12 +136,12 @@ namespace shibsp {
         }
     };
 
-    MatchFunctor* SHIBSP_DLLLOCAL AttributeScopeMatchesShibMDScopeFactory(const pair<const FilterPolicyContext*,const DOMElement*>& p, bool)
+    MatchFunctor* SHIBSP_DLLLOCAL AttributeScopeMatchesShibMDScopeFactory(const pair<const FilterPolicyContext*,const DOMElement*>&, bool)
     {
         return new AttributeScopeMatchesShibMDScopeFunctor();
     }
 
-    MatchFunctor* SHIBSP_DLLLOCAL AttributeValueMatchesShibMDScopeFactory(const pair<const FilterPolicyContext*,const DOMElement*>& p, bool)
+    MatchFunctor* SHIBSP_DLLLOCAL AttributeValueMatchesShibMDScopeFactory(const pair<const FilterPolicyContext*,const DOMElement*>&, bool)
     {
         return new AttributeValueMatchesShibMDScopeFunctor();
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list